report_view_record.go 885 B

1234567891011121314151617181920212223242526272829303132
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/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.NewOrmUsingDB("rddp")
  19. _, err = o.Insert(item)
  20. return
  21. }
  22. //修改最新阅读时间
  23. func SetWxUserReportLastViewTime(uid int) (err error) {
  24. o := orm.NewOrm()
  25. sql := `UPDATE wx_user SET report_last_view_time=NOW() WHERE user_id=? `
  26. _, err = o.Raw(sql, uid).Exec()
  27. return
  28. }