|
@@ -243,12 +243,22 @@ func GetIndustryNewLabelMap(industryIds []int) (labelMap map[int]bool, err error
|
|
nowTime := time.Now().Local()
|
|
nowTime := time.Now().Local()
|
|
threeMonthBefore := nowTime.AddDate(0, -3, 0)
|
|
threeMonthBefore := nowTime.AddDate(0, -3, 0)
|
|
nullTime, _ := time.ParseInLocation(utils.FormatDateTime, "0001-01-01 00:00:00", time.Local)
|
|
nullTime, _ := time.ParseInLocation(utils.FormatDateTime, "0001-01-01 00:00:00", time.Local)
|
|
|
|
+ industryMap := make(map[int]*models.IndustryArticleMinMaxPublishTime, 0)
|
|
for i := range industryTimeList {
|
|
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
|
|
return
|
|
}
|
|
}
|