report_view_record.go 851 B

123456789101112131415161718192021222324252627282930313233
  1. package models
  2. import (
  3. "rdluck_tools/orm"
  4. "time"
  5. )
  6. type ReportViewRecord struct {
  7. Id int `orm:"column(id);pk"`
  8. UserId int `description:"用户id"`
  9. ReportId int `description:"报告id"`
  10. Mobile string `description:"手机号"`
  11. Email string `description:"邮箱"`
  12. RealName string `description:"用户实际姓名"`
  13. CompanyName string `description:"公司名称"`
  14. CreateTime time.Time `description:"创建时间"`
  15. }
  16. //添加报告阅读记录
  17. func AddReportViewRecord(item *ReportViewRecord) (err error) {
  18. o := orm.NewOrm()
  19. o.Using("rddp")
  20. _, err = o.Insert(item)
  21. return
  22. }
  23. //修改最新阅读时间
  24. func SetWxUserReportLastViewTime(uid int) (err error) {
  25. o := orm.NewOrm()
  26. sql := `UPDATE wx_user SET report_last_view_time=NOW() WHERE user_id=? `
  27. _, err = o.Raw(sql, uid).Exec()
  28. return
  29. }