ziwen 2 years ago
parent
commit
3e89a5968d
2 changed files with 6 additions and 6 deletions
  1. 3 3
      controllers/report.go
  2. 3 3
      models/page_history_record.go

+ 3 - 3
controllers/report.go

@@ -392,7 +392,7 @@ func (this *ReportController) ArticleCategoryList() {
 		//查询用户今天是否看过时间线
 		haveMorningMeeting := false
 		var morningMeetingTime string
-		count, err := models.GetTimeLineRecordCount(user.UserId, industrialManagementId, time.Now().Format(utils.FormatDate))
+		count, err := models.GetTimeLineRecordCount(user.UserId, industrialManagementId)
 		if err != nil {
 			br.Msg = "查询浏览记录数量失败"
 			br.ErrMsg = "查询浏览记录数量失败,Err:" + err.Error()
@@ -666,7 +666,7 @@ func (this *ReportController) List() {
 		//}
 
 		//查询用户今天是否看过时间线
-		count, err := models.GetTimeLineRecordCount(user.UserId, industrialManagementId, time.Now().Format(utils.FormatDate))
+		count, err := models.GetTimeLineRecordCount(user.UserId, industrialManagementId)
 		if err != nil {
 			br.Msg = "查询浏览记录数量失败"
 			br.ErrMsg = "查询浏览记录数量失败,Err:" + err.Error()
@@ -687,7 +687,7 @@ func (this *ReportController) List() {
 				list[k].IsRed = true
 			}
 			timeLineRed := false
-			if count < 2 && v.SubCategoryName == "时间线" && recordItem.CreateTime.Before(utils.StrTimeToTime(v.PublishTime)){
+			if count < 2 && v.SubCategoryName == "时间线" {
 				timeLineRed = true
 			} else if count > 1 && recordItem.CreateTime.Before(utils.StrTimeToTime(v.PublishTime)){
 				timeLineRed = true

+ 3 - 3
models/page_history_record.go

@@ -51,10 +51,10 @@ type PageRouter struct {
 	PageRouter string
 }
 
-func GetTimeLineRecordCount(userId, industrialManagementId int, date string) (count int, err error) {
+func GetTimeLineRecordCount(userId, industrialManagementId int) (count int, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT COUNT(1) AS count FROM cygx_page_history_record WHERE user_id=? AND router = '/api/report/industry/ArticleList?PageSize=10&CurrentIndex=1&CategoryId=99999&IndustrialManagementId=`+strconv.Itoa(industrialManagementId)+ `' AND create_time > ? `
-	err = o.Raw(sql, userId, date).QueryRow(&count)
+	sql := `SELECT COUNT(1) AS count FROM cygx_page_history_record WHERE user_id=? AND router = '/api/report/industry/ArticleList?PageSize=10&CurrentIndex=1&CategoryId=99999&IndustrialManagementId=`+strconv.Itoa(industrialManagementId)
+	err = o.Raw(sql, userId).QueryRow(&count)
 	return
 }