micro_roadshow_video_history.go 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxMicroRoadshowVideoHistory struct {
  7. Id int `orm:"column(id);pk"description:"微路演视频浏览记录表id"`
  8. VideoId int `description:"微路演视频id"`
  9. UserId int `description:"用户id"`
  10. Mobile string `description:"手机号"`
  11. Email string `description:"邮箱"`
  12. CompanyId int `description:"公司Id"`
  13. CompanyName string `description:"公司名称"`
  14. RealName string `description:"用户实际名称"`
  15. SellerName string `description:"所属销售"`
  16. PlaySeconds string `description:"播放时间 单位s"`
  17. CreateTime time.Time `description:"视频创建时间"`
  18. ModifyTime time.Time `description:"视频修改时间"`
  19. RegisterPlatform int `description:"来源 1小程序,2:网页"`
  20. }
  21. // 获取列表信息根据手机号分组
  22. func GetMicroRoadshowVideoHistoryByMobileList(condition string) (items []*CygxMicroRoadshowVideoHistory, err error) {
  23. o := orm.NewOrm()
  24. sql := `SELECT * FROM cygx_micro_roadshow_video_history WHERE 1 =1 ` + condition + ` GROUP BY user_id `
  25. _, err = o.Raw(sql).QueryRows(&items)
  26. return
  27. }
  28. // 修改用户浏览产业视频的相关信息
  29. func UpdateCygxMicroRoadshowVideoHistory(wxUser *WxUserItem) (err error) {
  30. o := orm.NewOrm()
  31. var sql string
  32. if wxUser.Mobile != "" {
  33. sql = `UPDATE cygx_micro_roadshow_video_history SET email=?,company_id=?,company_name=?,user_id=?,real_name=? WHERE mobile=? `
  34. _, err = o.Raw(sql, wxUser.Email, wxUser.CompanyId, wxUser.CompanyName, wxUser.UserId, wxUser.RealName, wxUser.Mobile).Exec()
  35. } else if wxUser.Email != "" {
  36. sql = `UPDATE cygx_micro_roadshow_video_history SET mobile=?,company_id=?,company_name=?,user_id=?,real_name=? WHERE email=? `
  37. _, err = o.Raw(sql, wxUser.Mobile, wxUser.CompanyId, wxUser.CompanyName, wxUser.UserId, wxUser.RealName, wxUser.Email).Exec()
  38. }
  39. return
  40. }