cygx_yanxuan_special_record.go 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxYanxuanSpecialRecord struct {
  7. CygxYanxuanSpecialRecordId int `orm:"column(cygx_yanxuan_special_record_id);pk"`
  8. UserId int // 用户ID
  9. Mobile string // 手机号
  10. Email string // 邮箱
  11. CompanyId int // 公司ID
  12. CompanyName string // 公司名称
  13. RealName string // 用户实际名称
  14. SellerName string // 所属销售
  15. CreateTime time.Time // 创建时间
  16. ModifyTime time.Time // 修改时间
  17. RegisterPlatform int // 来源 1小程序,2:网页
  18. YanxuanSpecialId int // cygx_yanxuan_special 表主键ID
  19. StopTime int // 停留时间
  20. }
  21. func AddCygxYanxuanSpecialRecord(item *CygxYanxuanSpecialRecord) (lastId int64, err error) {
  22. o := orm.NewOrm()
  23. lastId, err = o.Insert(item)
  24. return
  25. }
  26. type AddCygxYanxuanSpecialRecordReq struct {
  27. SpecialId int `description:"专栏文章id"`
  28. StopTime int `description:"停留时间"`
  29. }
  30. // 判断一个用户是否阅读过 某一篇研选专栏
  31. func GetCygxYanxuanSpecialRecordCountByUser(userId, yanxuanSpecialId int) (count int, err error) {
  32. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_yanxuan_special_record as a WHERE user_id= ? AND yanxuan_special_id = ? `
  33. o := orm.NewOrm()
  34. err = o.Raw(sqlCount, userId, yanxuanSpecialId).QueryRow(&count)
  35. return
  36. }
  37. // 详细日志记录,不过滤时长小于 3 秒的那种
  38. type CygxYanxuanSpecialRecordLog struct {
  39. CygxYanxuanSpecialRecordId int `orm:"column(cygx_yanxuan_special_record_id);pk"`
  40. UserId int // 用户ID
  41. Mobile string // 手机号
  42. Email string // 邮箱
  43. CompanyId int // 公司ID
  44. CompanyName string // 公司名称
  45. RealName string // 用户实际名称
  46. SellerName string // 所属销售
  47. CreateTime time.Time // 创建时间
  48. ModifyTime time.Time // 修改时间
  49. RegisterPlatform int // 来源 1小程序,2:网页
  50. YanxuanSpecialId int // cygx_yanxuan_special 表主键ID
  51. StopTime int // 停留时间
  52. }
  53. func AddCygxYanxuanSpecialRecordLog(item *CygxYanxuanSpecialRecordLog) (lastId int64, err error) {
  54. o := orm.NewOrm()
  55. lastId, err = o.Insert(item)
  56. return
  57. }