Răsfoiți Sursa

Merge branch 'cygx/7.4' into debug

hsun 2 ani în urmă
părinte
comite
81ef910319
1 a modificat fișierele cu 14 adăugiri și 4 ștergeri
  1. 14 4
      services/industrial_management.go

+ 14 - 4
services/industrial_management.go

@@ -243,12 +243,22 @@ func GetIndustryNewLabelMap(industryIds []int) (labelMap map[int]bool, err error
 	nowTime := time.Now().Local()
 	threeMonthBefore := nowTime.AddDate(0, -3, 0)
 	nullTime, _ := time.ParseInLocation(utils.FormatDateTime, "0001-01-01 00:00:00", time.Local)
+	industryMap := make(map[int]*models.IndustryArticleMinMaxPublishTime, 0)
 	for i := range industryTimeList {
-		// 最早发布时间为空 / 最早发布时间在三个月前之后
-		if industryTimeList[i].MinPublishTime.Equal(nullTime) || (industryTimeList[i].MinPublishTime.After(threeMonthBefore)) {
-			labelMap[industryTimeList[i].IndustrialManagementId] = true
+		industryMap[industryTimeList[i].IndustrialManagementId] = industryTimeList[i]
+	}
+	for i := range industryIds {
+		iid := industryIds[i]
+		item := industryMap[iid]
+		if item != nil {
+			// 最早发布时间为空 / 最早发布时间在三个月前之后
+			if item.MinPublishTime.Equal(nullTime) || (item.MinPublishTime.After(threeMonthBefore)) {
+				labelMap[iid] = true
+			}
+		} else {
+			// 产业无报告, 则为新产业
+			labelMap[iid] = true
 		}
 	}
-
 	return
 }