|
@@ -389,12 +389,45 @@ func (this *ReportController) ArticleCategoryList() {
|
|
|
br.ErrMsg = "获取帖子数据失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ //查询用户今天是否看过时间线
|
|
|
+ haveMorningMeeting := false
|
|
|
+ var morningMeetingTime string
|
|
|
+ count, err := models.GetTimeLineRecordCount(user.UserId, industrialManagementId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "查询浏览记录数量失败"
|
|
|
+ br.ErrMsg = "查询浏览记录数量失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var recordItem *models.CygxPageHistoryRecord
|
|
|
+ if count > 1 {
|
|
|
+ recordItem, err = models.GetTimeLineRecordItem(user.UserId, industrialManagementId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "查询浏览记录失败"
|
|
|
+ br.ErrMsg = "查询浏览记录失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for _, v := range timeLineList {
|
|
|
if v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishTime)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishTime)) {
|
|
|
+ if v.SubCategoryName == "时间线" {
|
|
|
+ haveMorningMeeting = true
|
|
|
+ morningMeetingTime = v.PublishTime
|
|
|
+ continue
|
|
|
+ }
|
|
|
timeLineItem.IsRed = true
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ //因为无法记录用户是否看过晨会点评,所以用用户今天是否看过时间线来判断是否显示小红点,这里是判断分类的小红点
|
|
|
+ timeLineRed := false
|
|
|
+ if count < 2 {
|
|
|
+ timeLineRed = true
|
|
|
+ } else if count > 1 && recordItem.CreateTime.Before(utils.StrTimeToTime(morningMeetingTime)){
|
|
|
+ timeLineRed = true
|
|
|
+ }
|
|
|
+ if !timeLineItem.IsRed && timeLineRed && haveMorningMeeting {
|
|
|
+ timeLineItem.IsRed = true
|
|
|
+ }
|
|
|
list = append([]*models.IndustrialToArticleCategoryRep{&timeLineItem}, list...)
|
|
|
}
|
|
|
|
|
@@ -632,8 +665,34 @@ func (this *ReportController) List() {
|
|
|
// //list[i].Abstract, _ = services.GetReportContentTextSub(item.Abstract)
|
|
|
//}
|
|
|
|
|
|
+ //查询用户今天是否看过时间线
|
|
|
+ count, err := models.GetTimeLineRecordCount(user.UserId, industrialManagementId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "查询浏览记录数量失败"
|
|
|
+ br.ErrMsg = "查询浏览记录数量失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var recordItem *models.CygxPageHistoryRecord
|
|
|
+ if count > 1 {
|
|
|
+ recordItem, err = models.GetTimeLineRecordItem(user.UserId, industrialManagementId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "查询浏览记录失败"
|
|
|
+ br.ErrMsg = "查询浏览记录失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for k, v := range list {
|
|
|
- if v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishTime)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishTime)) {
|
|
|
+ if v.SubCategoryName != "时间线" && v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishTime)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishTime)) {
|
|
|
+ list[k].IsRed = true
|
|
|
+ }
|
|
|
+ timeLineRed := false
|
|
|
+ if count < 2 && v.SubCategoryName == "时间线" {
|
|
|
+ timeLineRed = true
|
|
|
+ } else if count > 1 && recordItem.CreateTime.Before(utils.StrTimeToTime(v.PublishTime)){
|
|
|
+ timeLineRed = true
|
|
|
+ }
|
|
|
+ if v.SubCategoryName == "时间线" && timeLineRed {
|
|
|
list[k].IsRed = true
|
|
|
}
|
|
|
if v.VideoUrl != "" {
|
|
@@ -2774,6 +2833,7 @@ func (this *ReportController) SearchReportAndResource() {
|
|
|
return
|
|
|
}
|
|
|
for _, v := range listHot {
|
|
|
+ industrialIdArr = append(industrialIdArr, v.IndustrialManagementId)
|
|
|
mapHot[v.IndustryName] = v.IndustrialManagementId
|
|
|
}
|
|
|
orderSrt := "man.recommended_index DESC,update_time DESC"
|
|
@@ -2831,9 +2891,115 @@ func (this *ReportController) SearchReportAndResource() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- for _, v2 := range list {
|
|
|
- if mapHistroyArticleId[v2.ArticleId] == 0 && user.CreatedTime.Before(utils.StrDateToTime(v.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrDateToTime(v.PublishDate)) {
|
|
|
- listHzResource[k].IsRed = true
|
|
|
+ mapUPdateTime := make(map[int]string)
|
|
|
+ //获取这些产业下最新更新的文章
|
|
|
+
|
|
|
+ //时间线的更新时间
|
|
|
+ // maptimelineUPdateTime := make(map[int]string)
|
|
|
+ listtimelinePublishdate, err := models.GetTimeLineReportIndustrialPublishdateList(industrialIdArr)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range listtimelinePublishdate {
|
|
|
+ if mapUPdateTime[v.IndustrialManagementId] != "" {
|
|
|
+ if utils.StrTimeToTime(v.PublishDate).After(utils.StrTimeToTime(mapUPdateTime[v.IndustrialManagementId])) {
|
|
|
+ mapUPdateTime[v.IndustrialManagementId] = v.PublishDate
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //mapHistroyArticleId := make(map[int]int)
|
|
|
+
|
|
|
+ //if userId > 0 {
|
|
|
+ // listArticleHistory, e := models.GetUserToArticleHistory(userId, articleIdArr)
|
|
|
+ // if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ // err = errors.New("获取产业关联的视频失败,GetindustryVideo " + e.Error())
|
|
|
+ // return
|
|
|
+ // }
|
|
|
+ // for _, v := range listArticleHistory {
|
|
|
+ // mapHistroyArticleId[v.ArticleId] = v.ArticleId
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ var industrialIds string
|
|
|
+ for _, id := range industrialIdArr {
|
|
|
+ industrialIds += strconv.Itoa(id) + ","
|
|
|
+ }
|
|
|
+ industrialIds = strings.TrimRight(industrialIds, ",")
|
|
|
+ articleList, err := models.GetReportIndustrialReadNumList(user.UserId, industrialIds, user.CreatedTime)
|
|
|
+ mapHistroyindustrialId := make(map[int]int)
|
|
|
+ for _, v := range articleList {
|
|
|
+ mapHistroyindustrialId[v.IndustrialManagementId] = v.Readnum
|
|
|
+ }
|
|
|
+ //nowTime := time.Now().Local()
|
|
|
+ //threeMonBefore := nowTime.AddDate(0, -3, 0)
|
|
|
+
|
|
|
+ //查询用户今天是否看过时间线
|
|
|
+ //haveMorningMeeting := false
|
|
|
+ //var morningMeetingTime string
|
|
|
+ recrodList, err := models.GetTimeLineRecordAllCount(user.UserId, time.Now().Format(utils.FormatDate))
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var industrialManagementIdstr string
|
|
|
+ industrialIdMap := make(map[string]time.Time)
|
|
|
+ for _, v := range recrodList {
|
|
|
+ industrialManagementIdstr = strings.TrimLeft(v.Parameter, "PageSize=10&CurrentIndex=1&CategoryId=99999&IndustrialManagementId=")
|
|
|
+ if createTime, ok := industrialIdMap[industrialManagementIdstr]; ok{
|
|
|
+ if createTime.Before(v.CreateTime) {
|
|
|
+ industrialIdMap[industrialManagementIdstr] = v.CreateTime
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ industrialIdMap[industrialManagementIdstr] = v.CreateTime
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ mmList, err := models.GetCygxMorningMeetingReviewsListByIndustrialIds(industrialIds)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ morningMeetingTimeMap := make(map[int]time.Time)
|
|
|
+ for _, v := range mmList {
|
|
|
+ morningMeetingTimeMap[v.IndustryId] = v.CreateTime
|
|
|
+ }
|
|
|
+ timeLineRedMap := make(map[int]bool, 0)
|
|
|
+
|
|
|
+ for _, industrialId := range industrialIdArr {
|
|
|
+ if createTime, ok := industrialIdMap[strconv.Itoa(industrialId)]; ok{
|
|
|
+ if createTime.Before(morningMeetingTimeMap[industrialId]) {
|
|
|
+ timeLineRedMap[industrialId] = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for k, v := range list {
|
|
|
+ list[k].UpdateTime = utils.TimeRemoveHms(mapUPdateTime[v.IndustrialManagementId])
|
|
|
+ if user.UserId > 0 {
|
|
|
+ //如果文章没有阅读,而且,文章的发布时间晚于项目的上线时间,而且文章的发布时间晚于用户的注册时间,就进行标红处理
|
|
|
+ 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])) {
|
|
|
+ list[k].IsRed = true
|
|
|
+ }
|
|
|
+ list[k].IsFollow = 0
|
|
|
+ }
|
|
|
+
|
|
|
+ list[k].UpdateTime = utils.TimeRemoveHms(mapUPdateTime[v.IndustrialManagementId])
|
|
|
+ if user.UserId > 0 {
|
|
|
+ //如果文章没有阅读,而且,文章的发布时间晚于项目的上线时间,而且文章的发布时间晚于用户的注册时间,就进行标红处理
|
|
|
+ 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])) {
|
|
|
+ list[k].IsRed = true
|
|
|
+ }
|
|
|
+ list[k].IsFollow = 0
|
|
|
}
|
|
|
}
|
|
|
|