micro_roadshow_video_history.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. }
  20. //获取列表信息根据手机号分组
  21. func GetMicroRoadshowVideoHistoryByMobileList(condition string) (items []*CygxMicroRoadshowVideoHistory, err error) {
  22. o := orm.NewOrm()
  23. sql := `SELECT * FROM cygx_micro_roadshow_video_history WHERE 1 =1 ` + condition + ` GROUP BY user_id `
  24. _, err = o.Raw(sql).QueryRows(&items)
  25. return
  26. }
  27. //修改用户浏览产业视频的相关信息
  28. func UpdateCygxMicroRoadshowVideoHistory(wxUser *WxUserItem) (err error) {
  29. o := orm.NewOrm()
  30. var sql string
  31. if wxUser.Mobile != "" {
  32. sql = `UPDATE cygx_micro_roadshow_video_history SET email=?,company_id=?,company_name=?,user_id=?,real_name=? WHERE mobile=? `
  33. _, err = o.Raw(sql, wxUser.Email, wxUser.CompanyId, wxUser.CompanyName, wxUser.UserId, wxUser.RealName, wxUser.Mobile).Exec()
  34. } else if wxUser.Email != "" {
  35. sql = `UPDATE cygx_micro_roadshow_video_history SET mobile=?,company_id=?,company_name=?,user_id=?,real_name=? WHERE email=? `
  36. _, err = o.Raw(sql, wxUser.Mobile, wxUser.CompanyId, wxUser.CompanyName, wxUser.UserId, wxUser.RealName, wxUser.Email).Exec()
  37. }
  38. return
  39. }