Browse Source

Merge branch 'cygx_9.2' into debug

ziwen 2 years ago
parent
commit
c593598d45
2 changed files with 28 additions and 13 deletions
  1. 1 1
      controllers/report.go
  2. 27 12
      controllers/research.go

+ 1 - 1
controllers/report.go

@@ -2823,7 +2823,7 @@ func (this *ReportController) SearchReportAndResource() {
 	mapHot := make(map[string]int)
 
 	hotCondition := ` ORDER BY sum_num DESC  `
-	listHot, err := models.GetThemeHeatList(user.UserId, hotCondition, 0, 3)
+	listHot, err := models.GetThemeHeatList(user.UserId, hotCondition, 0, pageSize)
 	if err != nil {
 		br.Msg = "获取信息失败"
 		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()

+ 27 - 12
controllers/research.go

@@ -1,10 +1,12 @@
 package controllers
 
 import (
+	"errors"
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"hongze/hongze_cygx/models"
 	"hongze/hongze_cygx/utils"
 	"strconv"
+	"time"
 )
 
 //研选
@@ -163,16 +165,16 @@ func (this *ResearchController) HotList() {
 		br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
 		return
 	}
-	newMap := make(map[int]string)
-	listNew, err := models.GetIndustrialManagementNewList("")
-	if err != nil {
-		br.Msg = "获取信息失败"
-		br.ErrMsg = "获取产业最新信息失败,Err:" + err.Error()
-		return
-	}
-	for _, v := range listNew {
-		newMap[v.IndustrialManagementId] = v.IndustryName
-	}
+	//newMap := make(map[int]string)
+	//listNew, err := models.GetIndustrialManagementNewList("")
+	//if err != nil {
+	//	br.Msg = "获取信息失败"
+	//	br.ErrMsg = "获取产业最新信息失败,Err:" + err.Error()
+	//	return
+	//}
+	//for _, v := range listNew {
+	//	newMap[v.IndustrialManagementId] = v.IndustryName
+	//}
 	condition = ` AND a.article_type_id > 0  `
 	listSubjcet, err := models.GetThemeHeatSubjectList(condition)
 	if err != nil {
@@ -192,9 +194,22 @@ func (this *ResearchController) HotList() {
 	for _, v := range listHot {
 		mapHot[v.IndustryName] = v.IndustrialManagementId
 	}
+	nowTime := time.Now().Local()
+	threeMonBefore := nowTime.AddDate(0, -3, 0)
 	for k, v := range list {
-		if newMap[v.IndustrialManagementId] != "" {
-			list[k].IsNew = true
+		//if newMap[v.IndustrialManagementId] != "" {
+		//	list[k].IsNew = true
+		//}
+		// 关联报告发布时间均在3个月内则标记New
+		if v.MinReportTime != "" {
+			t, e := time.Parse(utils.FormatDateTime, v.MinReportTime)
+			if e != nil {
+				err = errors.New("报告最早发布时间有误,GetindustryVideo " + e.Error())
+				return
+			}
+			if t.After(threeMonBefore) {
+				list[k].IsNew = true
+			}
 		}
 		if v.FllowNum > 0 {
 			list[k].IsFollw = true