Răsfoiți Sursa

活动详情新标签

hsun 2 ani în urmă
părinte
comite
0158993a14
4 a modificat fișierele cu 21 adăugiri și 27 ștergeri
  1. 15 23
      controllers/activity.go
  2. 0 1
      models/activity.go
  3. 2 1
      models/industrial_management.go
  4. 4 2
      services/activity.go

+ 15 - 23
controllers/activity.go

@@ -133,7 +133,6 @@ func (this *ActivityCoAntroller) ActivityList() {
 	if isShowJurisdiction == 1 && chartPermissionIds == "" && userType == 4 {
 		activityTypeIds = "1,3"
 	}
-	// TODO:【新】标签,【宏观】行业
 
 	var startSize int
 	if pageSize <= 0 {
@@ -888,6 +887,15 @@ func (this *ActivityCoAntroller) Detail() {
 			item.IndustryName = activityInfo.Label
 			industrialList = append(industrialList, item)
 		} else {
+			// 查研观向7.4-行业新标签
+			actIds := []int{activityId}
+			_, industryNewMap, e := services.GetActivityNewLabelMap(actIds)
+			if e != nil {
+				br.Msg = "获取信息失败"
+				br.ErrMsg = "获取活动产业新标签失败, Err: " + e.Error()
+				return
+			}
+
 			var industrialManagementId string
 			for k, v := range industrialList {
 				if v.ChartPermissionId == utils.CHART_PERMISSION_ID_YANXUAN {
@@ -916,6 +924,7 @@ func (this *ActivityCoAntroller) Detail() {
 					if mapIndustrial[v.IndustrialManagementId] > 0 {
 						industrialList[k].IsJump = true
 					}
+					industrialList[k].IndustryNewLabel = industryNewMap[v.IndustrialManagementId]
 				}
 			}
 		}
@@ -925,19 +934,8 @@ func (this *ActivityCoAntroller) Detail() {
 			activityInfo.YidongActivityUrl += "?source=11&fromHz=true&tgc=" + ydTgc
 		}
 		//处理按钮是否展示问题
-		actDetail := services.ActivityButtonShow(activityInfo)
+		resp.Detail = services.ActivityButtonShow(activityInfo)
 
-		// 查研观向7.4-行业新标签
-		actIds := []int{actDetail.ActivityId}
-		newLabelMap, e := services.GetActivityNewLabelMap(actIds)
-		if e != nil {
-			br.Msg = "获取信息失败"
-			br.ErrMsg = "获取活动产业新标签失败, Err: " + e.Error()
-			return
-		}
-		actDetail.IndustryNewLabel = newLabelMap[actDetail.ActivityId]
-
-		resp.Detail = actDetail
 	}
 	resp.HasPermission = hasPermission
 	br.Ret = 200
@@ -2719,9 +2717,7 @@ func (this *ActivityCoAntroller) ActivityListNew() {
 	}
 
 	// 查研观向7.4-始终查询宏观的活动
-	if chartPermissionIds == "" {
-		chartPermissionIds = "1"
-	} else {
+	if chartPermissionIds != "" {
 		chartPermissionIds += ",1"
 	}
 
@@ -3307,9 +3303,7 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 	}
 
 	// 查研观向7.4-始终查询宏观的活动
-	if chartPermissionIds == "" {
-		chartPermissionIds = "1"
-	} else {
+	if chartPermissionIds != "" {
 		chartPermissionIds += ",1"
 	}
 
@@ -3475,7 +3469,7 @@ func (this *ActivityCoAntroller) LabelTypeListV5() {
 	sort.Sort(sort.Reverse(sort.IntSlice(intArr)))
 
 	// 活动【新】标签Map
-	newLabelMap, e := services.GetActivityNewLabelMap(activityIds)
+	newLabelMap, _, e := services.GetActivityNewLabelMap(activityIds)
 	if e != nil {
 		br.Msg = "获取失败"
 		br.ErrMsg = "获取活动【新】标签Map失败, Err: " + e.Error()
@@ -4315,9 +4309,7 @@ func (this *ActivityCoAntroller) LabelTypeListV6Pc() {
 	}
 
 	// 查研观向7.4-始终查询宏观的活动
-	if chartPermissionIds == "" {
-		chartPermissionIds = "1"
-	} else {
+	if chartPermissionIds != "" {
 		chartPermissionIds += ",1"
 	}
 

+ 0 - 1
models/activity.go

@@ -182,7 +182,6 @@ type ActivityDetail struct {
 	IsCanAppointmentMinutes int                        `description:"是否可预约纪要 1是 ,0 否 默认0 "`
 	YidongActivityId        string                     `description:"易董活动ID"`
 	YidongActivityUrl       string                     `description:"易董活动跳转地址"`
-	IndustryNewLabel        bool                       `description:"是否产业新标签"`
 }
 
 type CygxActivityResp struct {

+ 2 - 1
models/industrial_management.go

@@ -18,6 +18,7 @@ type IndustrialManagementRep struct {
 	ArticleReadNum         int    `description:"文章阅读数量"`
 	IsResearch             bool   `description:"是否属于研选"`
 	IsJump                 bool   `description:"是否跳转"`
+	IndustryNewLabel       bool   `description:"是否产业新标签"`
 }
 
 type IndustrialManagementCount struct {
@@ -598,4 +599,4 @@ func GetSourceIndustryByName(industryName string) (item *IndustrialManagement, e
 				m.industrial_management_id`
 	err = orm.NewOrm().Raw(sql, industryName).QueryRow(&item)
 	return
-}
+}

+ 4 - 2
services/activity.go

@@ -1397,9 +1397,10 @@ func ActivityButtonShow(item *models.ActivityDetail) (articleDetail *models.Acti
 	return
 }
 
-// GetActivityNewLabelMap 获取活动【新】标签Map
-func GetActivityNewLabelMap(activityIds []int) (labelMap map[int]bool, err error) {
+// GetActivityNewLabelMap 获取活动【新】标签Map, 行业【新】标签Map
+func GetActivityNewLabelMap(activityIds []int) (labelMap map[int]bool, industryNewMap map[int]bool, err error) {
 	labelMap = make(map[int]bool, 0)
+	industryNewMap = make(map[int]bool, 0)
 	if len(activityIds) == 0 {
 		return
 	}
@@ -1443,6 +1444,7 @@ func GetActivityNewLabelMap(activityIds []int) (labelMap map[int]bool, err error
 	for i := range industryTimeList {
 		// 最早发布时间为空 / 最早发布时间在三个月前之后
 		if industryTimeList[i].MinPublishTime == nullTime || (industryTimeList[i].MinPublishTime.After(threeMonthBefore)) {
+			industryNewMap[industryTimeList[i].IndustrialManagementId] = true
 			for k, v := range activityIndustryMap {
 				if labelMap[k] {
 					continue