wangchuanjin 9 tahun lalu
induk
melakukan
e2a026597d

+ 3 - 3
core/src/qfw/member/service.go

@@ -168,9 +168,7 @@ func (yp *Service) Save() error {
 	}
 	if tempFlag {
 		//删除缓存信息
-		if len(serviceid) == 0 {
-			redis.Del("enterprise", "enterpriseInfo_"+enterpriseid)
-		}
+		redis.Del("enterprise", "enterpriseInfo_"+util.ObjToString(yp.GetSession("entid")))
 		//将数据存到elastic中
 		flag2 := elastic.UpdateNewDoc("service", "service", doc)
 		//Insertservicenames(enterpriseid)
@@ -313,6 +311,7 @@ func (u *Service) Del() error {
 			//再删除elasticsearch中的数据
 			flag2 := elastic.DelById(index, itype, id)
 			if flag2 {
+				redis.Del("enterprise", "enterpriseInfo_"+util.ObjToString(entid))
 				u.ServeJson(&map[string]interface{}{
 					"msg": "删除服务成功!",
 				})
@@ -369,6 +368,7 @@ func (u *Service) Remove() error {
 				isUpdate := elastic.UpdateNewDoc(index, itype, mongodb.FindById("service", sid, nil))
 
 				if isUpdate {
+					redis.Del("enterprise", "enterpriseInfo_"+util.ObjToString(entid))
 					u.ServeJson(&map[string]interface{}{
 						"msg": "下架成功!",
 					})

+ 7 - 0
core/src/qfw/member/yellowpage.go

@@ -241,11 +241,18 @@ func (yp *Yellowpage) WxFollow() error {
 
 //关注企业
 func (yp *Yellowpage) Follow() error {
+	defer util.Catch()
 	entId := yp.GetString("entId")
 	flag, _ := yp.GetBool("flag")
 	userId := yp.GetSession("userId").(string)
 	status := "n"
 	if flag {
+		data := mongodb.FindOne("follow_enterprise", `{"s_userid":"`+userId+`","s_entid":"`+entId+`"}`)
+		if data != nil && len(*data) > 0 {
+			(*data)["s_followid"] = util.BsonIdToSId((*data)["_id"])
+			delete((*data), "_id")
+			mongodb.Save("follow_enterprise_back", data)
+		}
 		if mongodb.Del("follow_enterprise", `{"s_userid":"`+userId+`","s_entid":"`+entId+`"}`) {
 			status = "y"
 		}

+ 13 - 12
core/src/qfw/searchmarket/service.go

@@ -50,22 +50,23 @@ func (s *Service) Slist() error {
 		start := (currentPage - 1) * limit
 		var count int
 		var r []map[string]interface{}
+		query := `{"query": {
+		    "bool": {
+			  "must":[
+				{"term":{"s_enterpriseid":"` + id + `"}},
+				{"query_string": {"default_field": "s_isshow","query": "*3*"}}
+			  ],
+			  "must_not":[{"term":{"i_status":1}}]
+		    }
+		  }`
+		queryCount := query + "}"
+		queryList := query + `,"from":` + fmt.Sprintf("%v", start) + `,"size":` + fmt.Sprintf("%v", limit) + `,"sort":[{"l_createdate":"desc"}]}`
 		searchtype := "service"
-		str := `{"prefix":{"s_enterpriseid":"` + id + `"}}`
-		var tempQuery = ""
-		tempQuery = `{"query": {
-	    "bool": {
-		  "must":[` + str + `],
-	      "minimum_should_match": 1
-	    }
-	  }}`
-		sort := `{"l_createdate":"desc"}`
 		if currentPage == 1 {
-			count = int(elastic.Count(searchtype, searchtype, tempQuery))
+			count = int(elastic.Count(searchtype, searchtype, queryCount))
 		}
 		//
-		query := `{"query":{"term":{"s_enterpriseid":"` + id + `"}},"from":` + fmt.Sprintf("%v", start) + `,"size":` + fmt.Sprintf("%v", limit) + `,"sort":[` + sort + `]}`
-		r = *elastic.Get(searchtype, searchtype, query)
+		r = *elastic.Get(searchtype, searchtype, queryList)
 		s.ServeJson(M{"list": r, "count": count})
 		return nil
 	}

+ 13 - 5
core/src/qfw/yellowpage/yellowpagemanager.go

@@ -215,6 +215,7 @@ func CommonEntInfo(yp *xweb.Action, id string, editFlag int, ismobile bool) erro
 		yp.T["copyright"] = FindOne("enterprise_copyright", `{"EntId":"`+id+`"}`)
 		//编辑企业名片标识
 		yp.T["editFlag"] = editFlag
+		yp.T["lastService"] = getLastService(id)
 		//过滤企业名
 		if relflag && nodes != nil && len(*nodes) > 0 {
 			go func() {
@@ -233,7 +234,6 @@ func CommonEntInfo(yp *xweb.Action, id string, editFlag int, ismobile bool) erro
 			return yp.Render("/enterprise/detail.html", &yp.T)
 		} else {
 			//服务数量
-			yp.T["serviceCount"] = getEntServiceCount(id)
 			var contentuser []byte
 			var erruser error
 			if ismobile {
@@ -530,13 +530,21 @@ func getDishonesty(legcerNo string, currentPage int) map[string]interface{} {
 }
 
 //获取该企业的服务数量
-func getEntServiceCount(id string) int64 {
+func getLastService(id string) string {
 	query := `{"query": {
 		    "bool": {
-			  "must":[{"query_string":{"default_field": "s_enterpriseid","query":"` + id + `"}}],"must_not" : [{"term" : {"i_status" : 1 }}]
+			  "must":[
+				  {"term":{"s_enterpriseid":"` + id + `"}},
+				  {"query_string": {"default_field": "s_isshow","query": "*3*"}}
+				],
+			  "must_not":[{"term":{"i_status":1}}]
 		    }
-		  }}`
-	return elastic.Count("service", "service", query)
+		  },"from":0,"size":1,"sort":[{"l_createdate":"desc"}]}`
+	r := elastic.Get("service", "service", query)
+	if r != nil && len(*r) == 1 {
+		return util.ObjToString((*r)[0]["_id"])
+	}
+	return ""
 }
 func checkAuth(obj map[string]interface{}) (b bool, err string) {
 	if len(obj) > 0 {

+ 1 - 1
core/src/web/staticres/css/entcommunity.css

@@ -507,7 +507,7 @@ a:focus, a:hover{
     color: #fff !important;
 	font-size: 12px !important;
 	left: 6px;
-	top: 1.5px;
+	top: 1px;
 }
 .ent-exception{
 	padding: 0px 6px;

+ 1 - 1
core/src/web/staticres/js/qfw.js

@@ -705,7 +705,7 @@ var TipAssembly = {
 		this.timeout = setTimeout(function(){
 			thisClass.hide();
 			thisClass.timeout = null;
-		},3000);
+		},1000);
 		$("body").append('<div class="tipAssembly" id="tipAssembly">'+text+'</div>');
 		if(typeof(css) != "undefined"){
 			$("#tipAssembly").css(css);

+ 2 - 2
core/src/web/templates/enterprise/detail.html

@@ -24,7 +24,7 @@
 			{{end}}
 		</div>
 		<div class="entinfo-cart{{if eq .T.editFlag 2}} entinfo-editcart{{end}}">
-			{{if eq .T.editFlag 1}}<a class="btn btn-primary btn-save" href="/member/enterprise/edit">编辑</a>{{end}}
+			{{if eq .T.editFlag 1}}<button class="btn btn-primary btn-save" onclick="window.location.href='/member/enterprise/edit'">编辑</button>{{end}}
 			{{if eq .T.editFlag 2}}<button id="editSave" class="btn btn-primary btn-save">保存</button>{{end}}
 			<div class="b-com-first">
 				<font class="b-com-title">{{if .T.res.EntName}}{{.T.res.EntName}}{{end}}</font>
@@ -74,7 +74,7 @@
 						{{end}}
 					{{end}}
 				{{end}}
-				{{if .T.serviceCount}}<a>服务信息<div class="servicelink"><i class="glyphicon qmx-icon-right"></i></div></a>{{end}}
+				{{if .T.lastService}}<a href="/market/detail/{{.T.lastService}}.html#moreservice">服务信息<div class="servicelink"><i class="glyphicon qmx-icon-right"></i></div></a>{{end}}
 			</div>
 			{{if eq .T.editFlag 2}}
 			<form class="b-editEnt-form" id="editForm">

+ 1 - 1
core/src/web/templates/member/mydemand.html

@@ -61,7 +61,7 @@
 			</div>
 			<div class="modal-footer">
 				<button type="button" class="btn btn-primary u-btn" id="revokeReason-sure">确认</button>
-				<button type="button" class="btn btn-btn-default u-btn" data-dismiss="modal">取消</button>
+				<button type="button" class="btn btn-default u-btn" data-dismiss="modal">取消</button>
 			</div>
 		</div>
 	</div>

+ 5 - 1
core/src/web/templates/service/detail.html

@@ -267,7 +267,7 @@
 			<a type="button" class="text-muted btnactive" style="margin-left:18px;border-left:1px solid #FFF;">服务详情</a>
 			<a type="button" class="text-muted">服务评价({{.T.sinfo.i_comments}})</a>
 			<a type="button" class="text-muted">预约记录({{.T.appcount}})</a>
-			<a type="button" class="text-muted">更多服务</a>
+			<a type="button" class="text-muted" id="moreservice">更多服务</a>
 			{{end}}
 			
 			{{if .T.status }}
@@ -529,6 +529,10 @@ $(function(){
 		$(".d_fwfl a").eq(1)[0].click();
 	}
 	setPrice();
+	//从企业社区的链接过来,自动显示服务列表
+	if(/\#moreservice$/.test(window.location.href)){
+		$(".d_fwfl a:last").click();
+	}
 });
 
 var limit=0;