|
@@ -1262,12 +1262,18 @@ func (this *ReportCommonController) CompanyList() {
|
|
|
// @Param IndustrialManagementId query int false "产业ID"
|
|
|
// @Success 200 {object} models.TacticsListResp
|
|
|
// @router /timeline [get]
|
|
|
-func (this *ReportCommonController) Timeline() {
|
|
|
+func (this *MobileReportController) Timeline() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
defer func() {
|
|
|
this.Data["json"] = br
|
|
|
this.ServeJSON()
|
|
|
}()
|
|
|
+ user := this.User
|
|
|
+ if user == nil {
|
|
|
+ br.Msg = "请重新登录"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
industrialManagementId, _ := this.GetInt("IndustrialManagementId")
|
|
@@ -1290,16 +1296,44 @@ func (this *ReportCommonController) Timeline() {
|
|
|
br.ErrMsg = "获取产业报告+晨会点评列表,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- lenList := len(list)
|
|
|
- for i := 0; i < lenList; i++ {
|
|
|
- item := list[i]
|
|
|
- list[i].Body = ""
|
|
|
- list[i].Abstract, _ = services.GetReportContentTextSub(item.Abstract)
|
|
|
- list[i].Annotation, _ = services.GetReportContentTextSub(item.Annotation)
|
|
|
- list[i].PublishDate = utils.StrTimeToTime(item.PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
|
|
|
+ //查询用户今天是否看过时间线
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //lenList := len(list)
|
|
|
+ for k, v := range list {
|
|
|
+ item := v
|
|
|
+ list[k].Body = ""
|
|
|
+ list[k].Abstract, _ = services.GetReportContentTextSub(item.Abstract)
|
|
|
+ list[k].Annotation, _ = services.GetReportContentTextSub(item.Annotation)
|
|
|
+ list[k].PublishDate = utils.StrTimeToTime(item.PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
|
|
|
//行业比较研究、资金流向,显示报告的摘要
|
|
|
if resp.MatchTypeName == "行业比较研究" || resp.MatchTypeName == "资金流向" {
|
|
|
- list[i].Annotation = list[i].Abstract
|
|
|
+ list[k].Annotation = list[k].Abstract
|
|
|
+ }
|
|
|
+ if v.SubCategoryName != "时间线" && v.Readnum == 0 && user.CreatedTime.Before(utils.StrTimeToTime(v.PublishDate)) && utils.StrTimeToTime(utils.OnlineTime).Before(utils.StrTimeToTime(v.PublishDate)) {
|
|
|
+ list[k].IsRed = true
|
|
|
+ }
|
|
|
+ timeLineRed := false
|
|
|
+ if count < 2 && v.SubCategoryName == "时间线" {
|
|
|
+ timeLineRed = true
|
|
|
+ } else if count > 1 && recordItem.CreateTime.Before(utils.StrTimeToTime(v.PublishDate)) {
|
|
|
+ timeLineRed = true
|
|
|
+ }
|
|
|
+ if v.SubCategoryName == "时间线" && timeLineRed {
|
|
|
+ list[k].IsRed = true
|
|
|
}
|
|
|
}
|
|
|
if len(list) == 0 {
|