소스 검색

no message

zhangchuanxing 3 달 전
부모
커밋
51e1bf1464

+ 12 - 3
controllers/report.go

@@ -51,6 +51,7 @@ func (this *MobileReportController) TradeList() {
 	var list []*models.TradeReportMapping
 	var err error
 	mapCategory := make(map[int]int)
+	mapCategoryFollowType := make(map[int]int)
 	if ChartPermissionId == utils.CE_LUE_ID || ChartPermissionId == utils.GU_SHOU_ID {
 		listTrade, errTrade := models.GetReportMappingStrategyHomeAllByCygx(user.UserId, ChartPermissionId)
 
@@ -99,6 +100,7 @@ func (this *MobileReportController) TradeList() {
 			}
 			for _, v := range categoryList {
 				mapCategory[v.IdCygx] = v.IdCygx
+				mapCategoryFollowType[v.IdCygx] = v.FollowType
 			}
 		}
 	} else {
@@ -153,6 +155,7 @@ func (this *MobileReportController) TradeList() {
 			if mapCategory[v.CategoryId] > 0 {
 				list[k].IsFollow = true
 			}
+			list[k].FollowType = mapCategoryFollowType[v.CategoryId]
 			list[k].ListArticle = make([]*models.HomeArticle, 0)
 		}
 	}
@@ -660,6 +663,7 @@ func (this *ReportController) IndustrialFllow() {
 		return
 	}
 	industrialManagementId := req.IndustrialManagementId
+	followType := req.FollowType
 	var condition string
 	countIndustrial, err := models.GetIndustrialManagementCount(industrialManagementId)
 	if err != nil {
@@ -681,6 +685,7 @@ func (this *ReportController) IndustrialFllow() {
 	resp := new(models.CygxIndustryFllowResp)
 	item := new(models.CygxIndustryFllow)
 	item.IndustrialManagementId = industrialManagementId
+	item.FollowType = followType
 	item.UserId = uid
 	item.Email = user.Email
 	item.Mobile = user.Mobile
@@ -702,7 +707,6 @@ func (this *ReportController) IndustrialFllow() {
 		resp.Status = 1
 		br.Msg = "关注成功"
 	} else {
-		item.Type = 2
 		err = models.RemoveCygxIndustryFllow(uid, industrialManagementId)
 		if err != nil {
 			br.Msg = "操作失败"
@@ -713,7 +717,7 @@ func (this *ReportController) IndustrialFllow() {
 		br.Msg = "已取消关注"
 	}
 	//处理是否关注全部赛道字段
-	go services.IndustryFllowWithTrack(industrialManagementId, count, uid)
+	//go services.IndustryFllowWithTrack(industrialManagementId, count, uid)
 	go services.IndustryFllowUserLabelLogAdd(industrialManagementId, count, uid) //处理用户标签
 	go services.AddCygxIndustryFllowLog(item)                                    //添加操作日志记录
 	br.Ret = 200
@@ -747,6 +751,7 @@ func (this *ReportController) CategoryFllow() {
 		return
 	}
 	categoryId := req.CategoryId
+	followType := req.FollowType
 	var condition string
 	//countCategory, err := models.GetCategoryCount(categoryId)
 	//if err != nil {
@@ -792,6 +797,7 @@ func (this *ReportController) CategoryFllow() {
 		item.RealName = user.RealName
 		item.CompanyId = user.CompanyId
 		item.CompanyName = user.CompanyName
+		item.FollowType = followType
 		item.CreateTime = time.Now()
 		item.ModifyTime = time.Now()
 		_, err = models.AddCygxCategoryFllow(item)
@@ -2275,7 +2281,7 @@ func (this *MobileReportController) ZouqiTradeList() {
 		return
 	}
 
-	fllowMap := services.GetXzsChooseCategoryZhouqiMapByMobile(user.Mobile)
+	fllowMap, fllowMapType := services.GetXzsChooseCategoryZhouqiMapByMobile(user.Mobile)
 
 	resp := new(models.TradeReportMappingResp)
 	var list []*models.TradeReportMapping
@@ -2288,6 +2294,7 @@ func (this *MobileReportController) ZouqiTradeList() {
 			item.MatchTypeName = v.MatchTypeName
 			item.UpdateTime = utils.TimeRemoveHms(v.ArticleUpdateTime)
 			item.IsFollow = fllowMap[item.CategoryId]
+			item.FollowType = fllowMapType[item.CategoryId]
 			item.ListArticle = make([]*models.HomeArticle, 0)
 			list = append(list, item)
 		}
@@ -2457,6 +2464,7 @@ func (this *ReportController) CategoryZhouqiFllow() {
 		return
 	}
 	categoryId := req.CategoryId
+	followType := req.FollowType
 	count, err := models.GetCountCategoryFllowZhouqi(categoryId, user.Mobile)
 	if err != nil {
 		br.Msg = "获取数据失败!"
@@ -2473,6 +2481,7 @@ func (this *ReportController) CategoryZhouqiFllow() {
 		item.RealName = user.RealName
 		item.CompanyId = user.CompanyId
 		item.CompanyName = user.CompanyName
+		item.FollowType = followType
 		item.CreateTime = time.Now()
 		item.ModifyTime = time.Now()
 		_, err = models.AddCygxCategoryFllowZhouqi(item)

+ 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)

+ 3 - 0
models/industry_fllow.go

@@ -18,14 +18,17 @@ type CygxIndustryFllow struct {
 	ModifyTime             time.Time `description:"更新时间"`
 	RealName               string    `description:"用户实际名称"`
 	Source                 int       `description:"来源1查研观向,2查研观向小助手"`
+	FollowType             int       `description:"1,重点关注,3不感兴趣,0默认接受推送"`
 }
 
 type CygxIndustryFllowRep struct {
 	IndustrialManagementId int `description:"产业D"`
+	FollowType             int `description:"1,重点关注,3不感兴趣,0默认接受推送"`
 }
 
 type CygxCategoryFllowRep struct {
 	CategoryId int `description:"分类ID"`
+	FollowType int `description:"1,重点关注,3不感兴趣,0默认接受推送"`
 }
 
 // 根据手机号获取用户关注的产业

+ 2 - 0
models/report.go

@@ -24,6 +24,7 @@ type IndustrialManagement struct {
 	IsRed                  bool                 `description:"是否标记红点"`
 	IsHot                  bool                 `description:"是否是热门"`
 	IsFollow               bool                 `description:"是否关注"`
+	FollowType             int                  `description:"1,重点关注,3不感兴趣,0默认接受推送"`
 	IsNew                  bool                 `description:"是否展示 NEW 标签"`
 	IsShowRoadshow         bool                 `description:"是否展示 微路演 标签"`
 	ArticleReadNum         int                  `description:"文章阅读数量"`
@@ -481,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:"是否新标签"`

+ 1 - 0
models/report_mapping.go

@@ -32,6 +32,7 @@ type TradeReportMapping struct {
 	MatchTypeName    string         `description:"匹配类型"`
 	IsRed            bool           `description:"是否标红"`
 	IsFollow         bool           `description:"是否关注"`
+	FollowType       int            `description:"1,重点关注,3不感兴趣,0默认接受推送"`
 	UpdateTime       string         `description:"更新时间"`
 	Readnum          int            `description:"阅读数量"`
 	ListArticle      []*HomeArticle `description:"文章列表"`

+ 1 - 0
models/xzs_choose_category.go

@@ -17,6 +17,7 @@ type CygxXzsChooseCategory struct {
 	CreateTime  time.Time `description:"创建时间"`
 	ModifyTime  time.Time `description:"更新时间"`
 	IdCygx      int       `description:"cygx_report_mapping_cygx 表主键ID"`
+	FollowType  int       `description:"1,重点关注,3不感兴趣,0默认接受推送"`
 }
 
 // 根据手机号获取用户关注的产业

+ 1 - 0
models/xzs_choose_category_zhouqi.go

@@ -16,6 +16,7 @@ type CygxXzsChooseCategoryZhouqi struct {
 	CategoryId  int       `description:"cygx_zhouqi_article_map 表主键"`
 	CreateTime  time.Time `description:"创建时间"`
 	ModifyTime  time.Time `description:"更新时间"`
+	FollowType  int       `description:"1,重点关注,3不感兴趣,0默认接受推送"`
 }
 
 // 根据手机号获取用户关注的产业

+ 3 - 1
services/ficc_report.go

@@ -8,7 +8,7 @@ import (
 )
 
 // GetXzsChooseCategoryZhouqiMapByMobile 根据手机号获取周期分类的关注信息
-func GetXzsChooseCategoryZhouqiMapByMobile(mobile string) (mapResp map[int]bool) {
+func GetXzsChooseCategoryZhouqiMapByMobile(mobile string) (mapResp map[int]bool, mapFollowResp map[int]int) {
 	if mobile == "" {
 		return
 	}
@@ -26,8 +26,10 @@ func GetXzsChooseCategoryZhouqiMapByMobile(mobile string) (mapResp map[int]bool)
 		return
 	}
 	mapResp = make(map[int]bool, 0)
+	mapFollowResp = make(map[int]int, 0)
 	for _, v := range listFollw {
 		mapResp[v.CategoryId] = true
+		mapFollowResp[v.CategoryId] = v.FollowType
 	}
 	return
 }

+ 30 - 0
services/industrial_management.go

@@ -86,9 +86,11 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 		return
 	}
 	fllowMap := make(map[int]int)
+	fllowTypeMap := make(map[int]int)
 	if len(fllowList) > 0 {
 		for _, v := range fllowList {
 			fllowMap[v.IndustrialManagementId] = v.IndustrialManagementId
+			fllowTypeMap[v.IndustrialManagementId] = v.FollowType
 		}
 	}
 
@@ -142,6 +144,7 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 			v.IndustryVideo = videoSimple
 		}
 		v.AuthInfo = au
+		v.FollowType = fllowTypeMap[v.IndustrialManagementId]
 	}
 	if len(industrialIdArr) > 0 {
 		//合并产业关联的标的
@@ -416,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
+}

+ 1 - 2
utils/constants.go

@@ -103,8 +103,7 @@ const (
 	REOURCE_YX                       string = "Yx"
 	REOURCE_HZ                       string = "Hz"
 	GU_SHOU_NAME                     string = "固收"
-	GU_SHOU_ID                       int    = 53                              // 自定义权限类型ID ,十万起步
-	GU_SHOU_ID_CHART                 int    = 53                              // chart_permission 表 固收ID
+	GU_SHOU_ID                       int    = 53                              //  chart_permission 表 固收ID
 	CYGX_TACTICS_TIME_LINE_STATUS    string = "cygx_tactics_time_line_status" // 策略时间线是否对外开放
 	CYGX_GUSHOU_TIME_LINE_STATUS     string = "cygx_gushou_time_line_status"  // 固收时间线是否对外开放
 	TIME_LINE_ID                     int    = 99999                           // 策略时间线的值