Browse Source

Merge branch 'dev3.0.0' of http://192.168.3.207:10080/qmx/jy into dev3.0.0

wangshan 4 years ago
parent
commit
67db9530de

+ 8 - 0
src/jfw/modules/bigmember/src/entity/followEnterprise.go

@@ -59,6 +59,14 @@ func (this *EntFollow) GetAssociationEnt(entName string) (map[string]string, err
 	return accMap, nil
 }
 
+func (this *EntFollow) CheckEntFollowed(entName string) (bool, error) {
+	if entName == "" {
+		return false, errors.New("企业名称异常")
+	}
+	count := db.Mgo.Count(this.SaveTable, map[string]interface{}{"s_entname": entName})
+	return count > 0, nil
+}
+
 //我关注的企业列表
 func (this *EntFollow) GetEntFollowList(pNum, pSize int) (followData []map[string]interface{}, hasNext bool, err error) {
 	count := db.Mgo.Count(this.SaveTable, map[string]interface{}{"s_userid": this.UserId})

+ 24 - 0
src/jfw/modules/bigmember/src/service/follow/enterprise.go

@@ -13,6 +13,7 @@ import (
 type FollowEnt struct {
 	*xweb.Action
 	association xweb.Mapper `xweb:"/follow/ent/association"` //搜索企业联想
+	followCheck xweb.Mapper `xweb:"/follow/ent/followCheck"` //企业是否关注
 	list        xweb.Mapper `xweb:"/follow/ent/list"`        //关注企业列表
 	addFollow   xweb.Mapper `xweb:"/follow/ent/addFollow"`   //添加关注标企业
 	delFollow   xweb.Mapper `xweb:"/follow/ent/delFollow"`   //取消关注标企业
@@ -43,6 +44,29 @@ func (this *FollowEnt) Association() {
 	this.ServeJson(NewResult(rData, errMsg))
 }
 
+//企业是否关注
+func (this *FollowEnt) FollowCheck() {
+	userId := qutil.ObjToString(this.GetSession("userId"))
+	rData, errMsg := func() (interface{}, error) {
+		followEntManager, err := entity.CreateEntFollowManager(userId)
+		if err != nil {
+			return nil, err
+		}
+		entName := this.GetString("entName")
+		followed, err := followEntManager.CheckEntFollowed(entName)
+		if err != nil {
+			return nil, err
+		}
+		return map[string]interface{}{
+			"followed": followed,
+		}, nil
+	}()
+	if errMsg != nil {
+		log.Printf("%s 企业关注联想出错查询是否关注出错:%s\n", userId, errMsg.Error())
+	}
+	this.ServeJson(NewResult(rData, errMsg))
+}
+
 //关注中标企业列表
 func (this *FollowEnt) List() {
 	userId := qutil.ObjToString(this.GetSession("userId"))

+ 1 - 1
src/jfw/modules/bigmember/src/service/portrait/entPortraitAction.go

@@ -52,7 +52,7 @@ func (this *EntPortrait) EntDetail() {
 		if err != nil {
 			return nil, err
 		}
-		entInfo["showEntChange"] = cepm.VipStatus == 3
+		entInfo["showEntChange"] = cepm.VipStatus == 1
 		return entInfo, nil
 	}()
 	if errMsg != nil {