浏览代码

新增最后一次阅读报告记录

rdluck 4 年之前
父节点
当前提交
0d9cdac3ec
共有 2 个文件被更改,包括 9 次插入1 次删除
  1. 2 0
      controllers/report.go
  2. 7 1
      models/report_view_record.go

+ 2 - 0
controllers/report.go

@@ -158,6 +158,8 @@ func (this *ReportController) Detail() {
 		if err != nil {
 			go utils.SendEmail(utils.APPNAME+"失败提醒", "新增报告阅读记录失败:Err:"+err.Error(), utils.EmailSendToUsers)
 		}
+		//修改联系人最后一次阅读报告时间
+		go models.SetWxUserReportLastViewTime(user.UserId)
 	}
 	reportType := 0
 	if report.ClassifyNameFirst == "权益研报" {

+ 7 - 1
models/report_view_record.go

@@ -20,4 +20,10 @@ func AddReportViewRecord(item *ReportViewRecord) (err error) {
 	return
 }
 
-//修改最新阅读时间
+//修改最新阅读时间
+func SetWxUserReportLastViewTime(uid int) (err error) {
+	o := orm.NewOrm()
+	sql := `UPDATE wx_user SET report_last_view_time=NOW() WHERE user_id=? `
+	_, err = o.Raw(sql, uid).Exec()
+	return
+}