zwxi 1 year ago
parent
commit
1e766c9e01
2 changed files with 8 additions and 3 deletions
  1. 6 2
      controllers/company_user.go
  2. 2 1
      models/company/company_user.go

+ 6 - 2
controllers/company_user.go

@@ -1210,6 +1210,10 @@ func (this *CompanyUserController) List() {
 				list[i].LastViewTimeStr = tmpLastViewTime.Format(utils.FormatDateTime)
 			}
 
+			if list[i].LastViewTime.Before(time.Now().AddDate(0,0,-7)) && list[i].IsFollow  == 1 {
+				list[i].NotRead = true
+			}
+
 			//如果有绑定数据,那么将数据返回对应的注册绑定数据
 			if _, ok := userRecordRegisterMap[int(item.UserId)]; ok {
 				list[i].IsRegister = true
@@ -5969,8 +5973,8 @@ func (this *CompanyUserController) Follow() {
 		return
 	}
 	if count == 3 && req.Type == 1 {
-		br.Msg = "操作失败! "
-		br.ErrMsg = "操作失败,公司已达到关注上限"
+		br.Msg = "关注失败,公司已达到关注上限 "
+		br.ErrMsg = "关注失败,公司已达到关注上限"
 		return
 	}
 

+ 2 - 1
models/company/company_user.go

@@ -68,6 +68,7 @@ type CompanyUser struct {
 	FiccLastViewTime         time.Time `description:"ficc报告最近一次阅读时间" json:"-"`
 	RaiViewTotal             int       `description:"权益报告的阅读次数" json:"-"`
 	RaiLastViewTime          time.Time `description:"权益报告的最近一次阅读时间" json:"-"`
+	NotRead                  bool      `description:"是否七天内未阅读"`
 }
 
 type CompanyUserListResp struct {
@@ -140,7 +141,7 @@ func GetCompanyUserListV2(condition string, pars []interface{}, companyId, start
 		sql += condition
 	}
 	//sql += ` group by a.user_id ORDER BY a.is_register desc,a.report_last_view_time desc,a.last_updated_time DESC LIMIT ?,? `
-	sql += ` group by a.user_id ORDER BY is_follow DESC, CASE WHEN is_follow = 1 AND report_last_view_time < NOW()  - INTERVAL 7 DAY THEN 0 ELSE 1 END  LIMIT ?,? `
+	sql += ` group by a.user_id ORDER BY CASE WHEN is_follow = 1 AND report_last_view_time < NOW()  - INTERVAL 7 DAY THEN 0 ELSE 1 END,a.is_register desc,a.report_last_view_time desc,a.last_updated_time DESC  LIMIT ?,? `
 	_, err = o.Raw(sql, companyId, pars, startSize, pageSize).QueryRows(&items)
 	return
 }