|
@@ -1556,51 +1556,52 @@ func ActivityButtonShow(item *models.ActivityDetail) (articleDetail *models.Acti
|
|
|
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
|
|
|
- //}
|
|
|
- //
|
|
|
- //// 获取活动关联的产业
|
|
|
- //var groupCond string
|
|
|
- //var groupPars []interface{}
|
|
|
- //groupCond += ` AND a.activity_id IN (` + utils.GetOrmInReplace(len(activityIds)) + `) AND b.source = 1 `
|
|
|
- //groupPars = append(groupPars, activityIds)
|
|
|
- //groups, e := models.GetActivityIndustryRelationList(groupCond, groupPars)
|
|
|
- //if e != nil {
|
|
|
- // err = errors.New("获取活动产业关联列表失败, Err: " + e.Error())
|
|
|
- // return
|
|
|
- //}
|
|
|
- //activityIndustryMap := make(map[int][]int, 0)
|
|
|
- //industryIds := make([]int, 0)
|
|
|
- //for i := range groups {
|
|
|
- // industryIds = append(industryIds, groups[i].IndustrialManagementId)
|
|
|
- // activityIndustryMap[groups[i].ActivityId] = append(activityIndustryMap[groups[i].ActivityId], groups[i].IndustrialManagementId)
|
|
|
- //}
|
|
|
- //
|
|
|
- //// 获取新产业Map
|
|
|
- //industryLabelMap, e := GetIndustryNewLabelMap(industryIds)
|
|
|
- //if e != nil {
|
|
|
- // err = errors.New("获取产业新标签Map失败, Err: " + e.Error())
|
|
|
- // return
|
|
|
- //}
|
|
|
- //
|
|
|
- //// 判断活动是否为新
|
|
|
- //for k := range industryLabelMap {
|
|
|
- // for k2, v2 := range activityIndustryMap {
|
|
|
- // if labelMap[k2] {
|
|
|
- // continue
|
|
|
- // }
|
|
|
- // // 活动的产业ID中存在一个新产业即为新活动
|
|
|
- // if utils.InArrayByInt(v2, k) {
|
|
|
- // labelMap[k2] = true
|
|
|
- // }
|
|
|
- // }
|
|
|
- //}
|
|
|
+ if len(activityIds) == 0 {
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
- for k := range activityIds {
|
|
|
- labelMap[k] = true
|
|
|
+ // 获取活动关联的产业
|
|
|
+ var groupCond string
|
|
|
+ var groupPars []interface{}
|
|
|
+ groupCond += ` AND a.activity_id IN (` + utils.GetOrmInReplace(len(activityIds)) + `) AND b.source = 1 `
|
|
|
+ groupPars = append(groupPars, activityIds)
|
|
|
+ groups, e := models.GetActivityIndustryRelationList(groupCond, groupPars)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("获取活动产业关联列表失败, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ activityIndustryMap := make(map[int][]int, 0)
|
|
|
+ industryIds := make([]int, 0)
|
|
|
+ for i := range groups {
|
|
|
+ industryIds = append(industryIds, groups[i].IndustrialManagementId)
|
|
|
+ activityIndustryMap[groups[i].ActivityId] = append(activityIndustryMap[groups[i].ActivityId], groups[i].IndustrialManagementId)
|
|
|
}
|
|
|
- //产业关联的弘则报告发布日期在三个月以内的活动、产业显示 NEW标签
|
|
|
+
|
|
|
+ // 获取新产业Map
|
|
|
+ industryLabelMap, e := GetIndustryNewLabelMap(industryIds)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("获取产业新标签Map失败, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 判断活动是否为新
|
|
|
+ for k := range industryLabelMap {
|
|
|
+ for k2, v2 := range activityIndustryMap {
|
|
|
+ if labelMap[k2] {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ // 活动的产业ID中存在一个新产业即为新活动
|
|
|
+ if utils.InArrayByInt(v2, k) {
|
|
|
+ labelMap[k2] = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //for _, v := range activityIds {
|
|
|
+ // labelMap[v] = true
|
|
|
+ //}
|
|
|
+ //fmt.Println(labelMap)
|
|
|
+ ////产业关联的弘则报告发布日期在三个月以内的活动、产业显示 NEW标签
|
|
|
articNewLabel, e := GetArticNewLabelWhithActivity3Month()
|
|
|
if e != nil {
|
|
|
err = errors.New("获取产业新标签Map失败, Err: " + e.Error())
|