Browse Source

Merge branch 'cygx_9.2' into debug

ziwen 2 years ago
parent
commit
491000edaf
2 changed files with 9 additions and 11 deletions
  1. 2 1
      models/report.go
  2. 7 10
      services/industrial_management.go

+ 2 - 1
models/report.go

@@ -159,7 +159,8 @@ WHERE
 //获取最新文章
 func GetNewIndustrialUserRecordArticle(industrialManagementId, categoryId int) (item *ArticleDetail, err error) {
 	o := orm.NewOrm()
-	sql := ` SELECT * FROM cygx_article WHERE article_id IN (SELECT article_id FROM cygx_industrial_article_group_management WHERE industrial_management_id = ? ) AND match_type_name = any( SELECT match_type_name FROM cygx_report_mapping WHERE category_id = ? ) ORDER BY publish_date DESC LIMIT 0, 1`
+	//sql := ` SELECT * FROM cygx_article WHERE article_id IN (SELECT article_id FROM cygx_industrial_article_group_management WHERE industrial_management_id = ? ) AND match_type_name = any( SELECT match_type_name FROM cygx_report_mapping WHERE category_id = ? ) ORDER BY publish_date DESC LIMIT 0, 1`
+	sql := ` SELECT * FROM cygx_article WHERE article_id IN (SELECT article_id FROM cygx_industrial_article_group_management WHERE industrial_management_id = ? ) AND category_id = ? ORDER BY publish_date DESC LIMIT 0, 1`
 	err = o.Raw(sql, industrialManagementId, categoryId).QueryRow(&item)
 	return
 }

+ 7 - 10
services/industrial_management.go

@@ -449,12 +449,12 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 	for _, v := range mmList {
 		morningMeetingTimeMap[v.IndustryId] = v.CreateTime
 	}
-	timeLineRed := false
+	timeLineRedMap := make(map[int]bool, 0)
 
 	for _, industrialId := range industrialIdArr {
 		if createTime, ok := industrialIdMap[strconv.Itoa(industrialId)]; ok{
 			if createTime.Before(morningMeetingTimeMap[industrialId]) {
-				timeLineRed = true
+				timeLineRedMap[industrialId] = true
 			}
 		}
 	}
@@ -463,7 +463,7 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 		list[k].UpdateTime = utils.TimeRemoveHms(mapUPdateTime[v.IndustrialManagementId])
 		if userId > 0 {
 			//如果文章没有阅读,而且,文章的发布时间晚于项目的上线时间,而且文章的发布时间晚于用户的注册时间,就进行标红处理
-			if mapHistroyindustrialId[v.IndustrialManagementId] == 0 || timeLineRed {
+			if mapHistroyindustrialId[v.IndustrialManagementId] == 0 || timeLineRedMap[v.IndustrialManagementId] {
 				if user.CreatedTime.Before(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) {
 					list[k].IsRed = true
 				}
@@ -478,13 +478,10 @@ func HandleIndustryList(list []*models.IndustrialManagement, user *models.WxUser
 		list[k].UpdateTime = utils.TimeRemoveHms(mapUPdateTime[v.IndustrialManagementId])
 		if userId > 0 {
 			//如果文章没有阅读,而且,文章的发布时间晚于项目的上线时间,而且文章的发布时间晚于用户的注册时间,就进行标红处理
-			//if user.CreatedTime.Before(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) {
-			//	list[k].IsRed = true
-			//}
-			
-			//9.2修改为只要有未读的就标红
-			if mapHistroyindustrialId[v.IndustrialManagementId] == 0 || timeLineRed {
-				list[k].IsRed = true
+			if mapHistroyindustrialId[v.IndustrialManagementId] == 0 || timeLineRedMap[v.IndustrialManagementId] {
+				if user.CreatedTime.Before(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) {
+					list[k].IsRed = true
+				}
 			}
 		} else {
 			if utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) {