Browse Source

no message

xingzai 3 years ago
parent
commit
bae8fa528e
1 changed files with 18 additions and 6 deletions
  1. 18 6
      controllers/research.go

+ 18 - 6
controllers/research.go

@@ -44,14 +44,20 @@ func (this *ResearchController) NewList() {
 		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
 		return
 	}
-	detailHot3, err := models.GetIndustrialManagementHot3(chartPermissionId)
+	mapHot := make(map[string]int)
+
+	condition := ` ORDER BY sum_num DESC LIMIT 15 `
+	listHot, err := models.GetThemeHeatList(categoryinfo.PermissionName, user.UserId, condition)
 	if err != nil {
 		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取信息失败,Err:" + err.Error()
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
 		return
 	}
+	for _, v := range listHot {
+		mapHot[v.IndustryName] = v.IndustrialManagementId
+	}
 	for k, v := range list {
-		if v.ArticleReadNum >= detailHot3.ArticleReadNum {
+		if mapHot[v.IndustryName] > 0 {
 			list[k].IsHot = true
 		}
 	}
@@ -172,12 +178,18 @@ func (this *ResearchController) HotList() {
 		br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
 		return
 	}
-	detailHot3, err := models.GetIndustrialManagementHot3(chartPermissionId)
+	mapHot := make(map[string]int)
+
+	condition = ` ORDER BY sum_num DESC LIMIT 15 `
+	listHot, err := models.GetThemeHeatList(categoryinfo.PermissionName, user.UserId, condition)
 	if err != nil {
 		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取信息失败,Err:" + err.Error()
+		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
 		return
 	}
+	for _, v := range listHot {
+		mapHot[v.IndustryName] = v.IndustrialManagementId
+	}
 	for k, v := range list {
 		if newMap[v.IndustrialManagementId] != "" {
 			list[k].IsNew = true
@@ -190,7 +202,7 @@ func (this *ResearchController) HotList() {
 				list[k].IndustrialSubjectList = append(list[k].IndustrialSubjectList, v2)
 			}
 		}
-		if v.ArticleReadNum >= detailHot3.ArticleReadNum {
+		if mapHot[v.IndustryName] > 0 {
 			list[k].IsHot = true
 		}
 	}