research_summary_voice_history.go 1.5 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. }
  20. //添加
  21. func AddCygxResearchSummaryVoiceHistory(item *CygxResearchSummaryVoiceHistory) (err error) {
  22. o := orm.NewOrm()
  23. _, err = o.Insert(item)
  24. return
  25. }
  26. func GetLastCygxResearchSummaryVoiceHistory(articleId, userId int) (item *CygxResearchSummaryVoiceHistory, err error) {
  27. o := orm.NewOrm()
  28. sql := ` SELECT * FROM cygx_research_summary_voice_history WHERE article_id=? AND user_id=? ORDER BY create_time DESC limit 1 `
  29. err = o.Raw(sql, articleId, userId).QueryRow(&item)
  30. return
  31. }
  32. func UpdateLastCygxResearchSummaryVoiceHistory(playSeconds string, lastId int) (err error) {
  33. o := orm.NewOrm()
  34. sql := ` UPDATE cygx_research_summary_voice_history SET play_seconds =? WHERE id=? `
  35. _, err = o.Raw(sql, playSeconds, lastId).Exec()
  36. return
  37. }