package models import ( "rdluck_tools/orm" "time" ) type ReportViewRecord struct { Id int `orm:"column(id);pk"` UserId int `description:"用户id"` ReportId int `description:"报告id"` CreateTime time.Time `description:"创建时间"` } //添加报告阅读记录 func AddReportViewRecord(item *ReportViewRecord) (err error) { o := orm.NewOrm() o.Using("rddp") _, err = o.Insert(item) 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 }