소스 검색

Merge branch 'cygx_9.7' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 2 년 전
부모
커밋
34428f5fc4
5개의 변경된 파일43개의 추가작업 그리고 1개의 파일을 삭제
  1. 11 0
      controllers/activity.go
  2. 11 0
      controllers/article.go
  3. 1 0
      models/activity.go
  4. 1 0
      models/article.go
  5. 19 1
      services/config.go

+ 11 - 0
controllers/activity.go

@@ -498,6 +498,17 @@ func (this *ActivityCoAntroller) Detail() {
 		activityInfo.SignupType = mapActivitySignup[activityId]
 		//判断是不是通过微信模版推送消息进来的
 		if isSendWx == 1 && len(industrialList) > 0 {
+			industryUserFollowMap, err := services.GetIndustryUserFollowMap(user)
+			if err != nil {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "GetActivitySignupResp,Err:" + err.Error()
+				return
+			}
+			for _, v := range industrialList {
+				if industryUserFollowMap[v.IndustrialManagementId] {
+					activityInfo.IsFollowButton = true
+				}
+			}
 			activityInfo.IsShowFollowButton = true
 		}
 		if activityInfo.ReportLink != "" {

+ 11 - 0
controllers/article.go

@@ -95,6 +95,17 @@ func (this *ArticleController) Detail() {
 			return
 		}
 		if len(industrialList) > 0 {
+			industryUserFollowMap, err := services.GetIndustryUserFollowMap(user)
+			if err != nil {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "GetActivitySignupResp,Err:" + err.Error()
+				return
+			}
+			for _, v := range industrialList {
+				if industryUserFollowMap[v.IndustrialManagementId] {
+					detail.IsFollowButton = true
+				}
+			}
 			detail.IsShowFollowButton = true
 		}
 	}

+ 1 - 0
models/activity.go

@@ -197,6 +197,7 @@ type ActivityDetail struct {
 	ActivityTimeEnd         string                     `description:"专项产业调研活动预期结束时间"`
 	IsCollect               bool                       `description:"是否收藏"`
 	IsShowFollowButton      bool                       `description:"是否展示关注取关按钮"`
+	IsFollowButton          bool                       `description:"是否关注"`
 	ListArticle             []*ArticleIdAndTitle       `description:"活动关联的文章"`
 }
 type ListArticleActivity struct {

+ 1 - 0
models/article.go

@@ -164,6 +164,7 @@ type ArticleDetail struct {
 	IsSpecialArticle        bool   `description:"是否属于专项调研报告"`
 	Annotation              string `description:"核心观点"`
 	IsShowFollowButton      bool   `description:"是否展示关注取关按钮"`
+	IsFollowButton          bool   `description:"是否关注"`
 }
 
 type ArticleDetailFileLink struct {

+ 19 - 1
services/config.go

@@ -1,11 +1,13 @@
 package services
 
 import (
+	"errors"
 	"fmt"
 	"hongze/hongze_cygx/models"
+	"strconv"
 )
 
-//是否展示限免标签
+// 是否展示限免标签
 func GetShowSustainable() (isShowSustainable bool) {
 	total, err := models.GetShowSustainable()
 	if err != nil {
@@ -29,3 +31,19 @@ func GetShowSustainableNew() (isShowSustainable bool, err error) {
 	}
 	return
 }
+
+// GetIndustryUserFollowMap 获取用户关注的产业
+func GetIndustryUserFollowMap(user *models.WxUserItem) (itemMap map[int]bool, err error) {
+	condition := ` AND  user_id = ` + strconv.Itoa(user.UserId)
+	listIndustryFllow, e := models.GetCygxIndustryFllowList(condition)
+	if e != nil {
+		err = errors.New("GetCygxIndustryFllowList  " + e.Error())
+		return
+	}
+	follwMap := make(map[int]bool)
+	for _, v := range listIndustryFllow {
+		follwMap[v.IndustrialManagementId] = true
+	}
+	itemMap = follwMap
+	return
+}