banner_view_history.go 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // BannerViewHistory banner访问历史
  7. type BannerViewHistory struct {
  8. ViewHistoryID uint64 `orm:"column(view_history_id);pk"` // id
  9. UserID uint64 // 用户id
  10. Mobile string // 手机号
  11. Email string // 邮箱
  12. RealName string // 用户实际名称
  13. CompanyName string // 公司名称
  14. CreatedTime time.Time // 创建时间
  15. LastUpdatedTime time.Time
  16. FirstSource int // 一级来源 1小程序移动 2小程序pc 3研报官网
  17. SecondSource int // 二级来源 1首页 2研报详情页
  18. BannerUrl string
  19. }
  20. func GetBannerHistoryList() (items []*BannerHistoryListRespItem, err error) {
  21. sql := ` SELECT * FROM banner_view_history WHERE 1=1 GROUP BY banner_url `
  22. o := orm.NewOrm()
  23. _, err = o.Raw(sql).QueryRows(&items)
  24. return
  25. }
  26. type SourcePv struct {
  27. FirstSource int
  28. SecondSource int
  29. PV int
  30. LastUpdatedTime string
  31. }
  32. type BannerHistoryListRespItem struct {
  33. ViewHistoryID uint64 `orm:"column(view_history_id);pk"` // id
  34. UserID uint64 // 用户id
  35. Mobile string // 手机号
  36. Email string // 邮箱
  37. RealName string // 用户实际名称
  38. CompanyName string // 公司名称
  39. CreatedTime string // 创建时间
  40. LastUpdatedTime string
  41. FirstSource int // 一级来源 1小程序移动 2小程序pc 3研报官网
  42. SecondSource int // 二级来源 1首页 2研报详情页
  43. BannerUrl string
  44. PV int
  45. SourceList []SourcePv
  46. }
  47. type BannerHistoryListResp struct {
  48. List []*BannerHistoryListRespItem
  49. }