research_summary_voice_history.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxResearchSummaryVoiceHistory struct {
  7. Id int `orm:"column(id);pk"`
  8. ArticleId int `description:"文章ID"`
  9. UserId int `description:"用户ID"`
  10. CreateTime time.Time `description:"创建时间"`
  11. Mobile string `description:"手机号"`
  12. Email string `description:"邮箱"`
  13. CompanyId int `description:"公司id"`
  14. CompanyName string `description:"公司名称"`
  15. RealName string `description:"用户实际名称"`
  16. SellerName string `description:"所属销售"`
  17. PlaySeconds string `description:"播放时间 单位s"`
  18. ModifyTime time.Time `description:"视频修改时间"`
  19. RegisterPlatform int `description:"来源 1小程序,2:网页"`
  20. }
  21. // 添加
  22. func AddCygxResearchSummaryVoiceHistory(item *CygxResearchSummaryVoiceHistory) (err error) {
  23. o := orm.NewOrm()
  24. _, err = o.Insert(item)
  25. return
  26. }
  27. func GetLastCygxResearchSummaryVoiceHistory(articleId, userId int) (item *CygxResearchSummaryVoiceHistory, err error) {
  28. o := orm.NewOrm()
  29. sql := ` SELECT * FROM cygx_research_summary_voice_history WHERE article_id=? AND user_id=? ORDER BY create_time DESC limit 1 `
  30. err = o.Raw(sql, articleId, userId).QueryRow(&item)
  31. return
  32. }
  33. func UpdateLastCygxResearchSummaryVoiceHistory(playSeconds string, lastId int) (err error) {
  34. o := orm.NewOrm()
  35. sql := ` UPDATE cygx_research_summary_voice_history SET play_seconds =? WHERE id=? `
  36. _, err = o.Raw(sql, playSeconds, lastId).Exec()
  37. return
  38. }