|
@@ -392,6 +392,21 @@ func (this *ReportController) ArticleCategoryList() {
|
|
|
//查询用户今天是否看过时间线
|
|
|
haveMorningMeeting := false
|
|
|
count, err := models.GetTimeLineRecordCount(user.UserId, industrialManagementId, time.Now().Format(utils.FormatDate))
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "查询浏览记录数量失败"
|
|
|
+ br.ErrMsg = "查询浏览记录数量失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var recordItem *models.CygxPageHistoryRecord
|
|
|
+ if count > 0 {
|
|
|
+ recordItem, err = models.GetTimeLineRecordItem(user.UserId, industrialManagementId, time.Now().Format(utils.FormatDate))
|
|
|
+ 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 == "时间线" {
|
|
@@ -402,7 +417,13 @@ func (this *ReportController) ArticleCategoryList() {
|
|
|
}
|
|
|
}
|
|
|
//因为无法记录用户是否看过晨会点评,所以用用户今天是否看过时间线来判断是否显示小红点,这里是判断分类的小红点
|
|
|
- if !timeLineItem.IsRed && count == 0 && haveMorningMeeting {
|
|
|
+ timeLineRed := false
|
|
|
+ if count == 0 {
|
|
|
+ timeLineRed = true
|
|
|
+ } else if count > 0 && recordItem.CreateTime.Before(utils.StrTimeToTime(v.PublishTime)){
|
|
|
+ timeLineRed = true
|
|
|
+ }
|
|
|
+ if !timeLineItem.IsRed && timeLineRed && haveMorningMeeting {
|
|
|
timeLineItem.IsRed = true
|
|
|
}
|
|
|
list = append([]*models.IndustrialToArticleCategoryRep{&timeLineItem}, list...)
|
|
@@ -644,11 +665,32 @@ func (this *ReportController) List() {
|
|
|
|
|
|
//查询用户今天是否看过时间线
|
|
|
count, err := models.GetTimeLineRecordCount(user.UserId, industrialManagementId, time.Now().Format(utils.FormatDate))
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "查询浏览记录数量失败"
|
|
|
+ br.ErrMsg = "查询浏览记录数量失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var recordItem *models.CygxPageHistoryRecord
|
|
|
+ if count > 0 {
|
|
|
+ recordItem, err = models.GetTimeLineRecordItem(user.UserId, industrialManagementId, time.Now().Format(utils.FormatDate))
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "查询浏览记录失败"
|
|
|
+ br.ErrMsg = "查询浏览记录失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for k, v := range list {
|
|
|
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
|
|
|
}
|
|
|
- if v.SubCategoryName == "时间线" && count == 0 {
|
|
|
+ timeLineRed := false
|
|
|
+ if count == 0 {
|
|
|
+ timeLineRed = true
|
|
|
+ } else if count > 0 && recordItem.CreateTime.Before(utils.StrTimeToTime(v.PublishTime)){
|
|
|
+ timeLineRed = true
|
|
|
+ }
|
|
|
+ if v.SubCategoryName == "时间线" && timeLineRed {
|
|
|
list[k].IsRed = true
|
|
|
}
|
|
|
if v.VideoUrl != "" {
|