123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type BannerViewHistory struct {
- ViewHistoryID uint64 `orm:"column(view_history_id);pk"`
- UserID uint64
- Mobile string
- Email string
- RealName string
- CompanyName string
- CreatedTime time.Time
- LastUpdatedTime time.Time
- FirstSource int
- SecondSource int
- BannerUrl string
- }
- func GetBannerHistoryList() (items []*BannerHistoryListRespItem, err error) {
- sql := ` SELECT *,COUNT(*) AS pv,MAX(last_updated_time) AS last_updated_time FROM banner_view_history
- WHERE 1=1 GROUP BY
- banner_url,
- first_source,
- second_source `
- o := orm.NewOrm()
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
- type SourcePv struct {
- FirstSource int
- SecondSource int
- Pv int
- LastUpdatedTime string
- }
- type BannerHistoryListRespItem struct {
- ViewHistoryID uint64 `orm:"column(view_history_id);pk"`
- UserID uint64
- Mobile string
- Email string
- RealName string
- CompanyName string
- CreatedTime string
- LastUpdatedTime string
- FirstSource int
- SecondSource int
- BannerUrl string
- Pv int
- SourceList []*SourcePv
- StartDate string
- EndDate string
- Remark string
- }
- type BannerHistoryListResp struct {
- List []*BannerHistoryListRespItem
- }
- func GetBannerUrlList() (items []*BannerHistoryListRespItem, err error) {
- sql := ` SELECT *,COUNT(*) AS pv FROM banner_view_history WHERE 1=1 GROUP BY banner_url `
- o := orm.NewOrm()
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
|