Ver Fonte

no message

zhangchuanxing há 3 meses atrás
pai
commit
00819230d5
3 ficheiros alterados com 32 adições e 0 exclusões
  1. 4 0
      controllers/research.go
  2. 1 0
      models/report.go
  3. 27 0
      services/industrial_management.go

+ 4 - 0
controllers/research.go

@@ -368,6 +368,9 @@ func (this *MobileResearchController) HotList() {
 		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
 		return
 	}
+
+	followTypeMap := services.GetCygxIndustryFllowListTypeMapByMobile(user.Mobile) // 关注的对应状态
+
 	listSubjcet, err := models.GetThemeHeatSubjectList(condition)
 	if err != nil {
 		br.Msg = "获取信息失败"
@@ -396,6 +399,7 @@ func (this *MobileResearchController) HotList() {
 		if v.FllowNum > 0 {
 			list[k].IsFollow = true
 		}
+		list[k].FollowType = followTypeMap[v.IndustrialManagementId]
 		for _, v2 := range listSubjcet {
 			if v2.IndustrialManagementId == v.IndustrialManagementId {
 				list[k].IndustrialSubjectList = append(list[k].IndustrialSubjectList, v2)

+ 1 - 0
models/report.go

@@ -482,6 +482,7 @@ type IndustrialManagementHotResp struct {
 	IndustrialManagementId int                  `orm:"column(industrial_management_id);pk" description:"产业id"`
 	IndustryName           string               `description:"产业名称"`
 	IsFollow               bool                 `description:"是否关注"`
+	FollowType             int                  `description:"1,重点关注,3不感兴趣,0默认接受推送"`
 	FllowNum               int                  `description:"关注数量"`
 	IsNew                  bool                 `description:"是否新标签"`
 	IsHot                  bool                 `description:"是否新标签"`

+ 27 - 0
services/industrial_management.go

@@ -419,3 +419,30 @@ func IndustrialManagementHotMapGropuPermission() (mapResp map[int]bool, err erro
 	}
 	return
 }
+
+// GetCygxIndustryFllowListTypeMapByMobile 根据手机号获取产业关注的信息
+func GetCygxIndustryFllowListTypeMapByMobile(mobile string) (mapFollowTypeResp map[int]int) {
+	if mobile == "" {
+		return
+	}
+	var err error
+	defer func() {
+		if err != nil {
+			fmt.Println("err:", err)
+			go utils.SendAlarmMsg(fmt.Sprint("根据手机号获取产业关注的信息 失败,GetCygxIndustryFllowListTypeMapByMobile Err:"+err.Error()+"mobile", mobile), 3)
+		}
+	}()
+
+	mapFollowTypeResp = make(map[int]int, 0)
+	fllowList, e := models.GetCygxIndustryFllowList(mobile)
+	//策略的处理
+	if e != nil {
+		err = errors.New("GetUserFllowIndustrialList, Err: " + err.Error())
+		return
+	}
+	for _, v := range fllowList {
+		mapFollowTypeResp[v.IndustrialManagementId] = v.FollowType
+	}
+
+	return
+}