Jelajahi Sumber

fix:联系人更换客户时,查询阅读记录调整

Roc 1 tahun lalu
induk
melakukan
90064d94b4
2 mengubah file dengan 16 tambahan dan 1 penghapusan
  1. 14 1
      controllers/company_user.go
  2. 2 0
      models/company/company_user.go

+ 14 - 1
controllers/company_user.go

@@ -1196,6 +1196,19 @@ func (this *CompanyUserController) List() {
 			//}*/
 
 			list[i].ViewTotal = list[i].FiccViewTotal + list[i].RaiViewTotal
+			var tmpLastViewTime time.Time
+			tmpLastViewTime = list[i].FiccLastViewTime
+
+			if !list[i].RaiLastViewTime.IsZero() {
+				if tmpLastViewTime.IsZero() || list[i].RaiLastViewTime.After(tmpLastViewTime) {
+					tmpLastViewTime = list[i].RaiLastViewTime
+				}
+			}
+
+			list[i].LastViewTime = tmpLastViewTime
+			if !tmpLastViewTime.IsZero() {
+				list[i].LastViewTimeStr = tmpLastViewTime.Format(utils.FormatDateTime)
+			}
 
 			//如果有绑定数据,那么将数据返回对应的注册绑定数据
 			if _, ok := userRecordRegisterMap[int(item.UserId)]; ok {
@@ -2988,7 +3001,7 @@ func (this *CompanyUserController) ViewReportList() {
 	case 1:
 		baseCondition += ` AND source = ? `
 		basePars = append(basePars, 4)
-		
+
 		total = item.RaiViewTotal
 		if lastViewTimeT.IsZero() {
 			if item.RaiLastViewTime != `` && item.RaiLastViewTime != `0000-00-00 00:00:00` {

+ 2 - 0
models/company/company_user.go

@@ -64,7 +64,9 @@ type CompanyUser struct {
 	IsSubscribeHzyj          int       `description:"是否关注了弘则研究微信公众号: 0-未关注; 1-已关注"`
 	IsSubscribeCygx          int       `description:"是否关注了查研观向微信公众号: 0-未关注; 1-已关注"`
 	FiccViewTotal            int       `description:"ficc报告的阅读次数" json:"-"`
+	FiccLastViewTime         time.Time `description:"ficc报告最近一次阅读时间" json:"-"`
 	RaiViewTotal             int       `description:"权益报告的阅读次数" json:"-"`
+	RaiLastViewTime          time.Time `description:"权益报告的最近一次阅读时间" json:"-"`
 }
 
 type CompanyUserListResp struct {