12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxYanxuanSpecialRecord struct {
- CygxYanxuanSpecialRecordId int `orm:"column(cygx_yanxuan_special_record_id);pk"`
- UserId int
- Mobile string
- Email string
- CompanyId int
- CompanyName string
- RealName string
- SellerName string
- CreateTime time.Time
- ModifyTime time.Time
- RegisterPlatform int
- YanxuanSpecialId int
- StopTime int
- PermissionCode int
- }
- func AddCygxYanxuanSpecialRecord(item *CygxYanxuanSpecialRecord) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- type AddCygxYanxuanSpecialRecordReq struct {
- SpecialId int `description:"专栏文章id"`
- StopTime int `description:"停留时间"`
- }
- func GetCygxYanxuanSpecialRecordCountByUser(userId, yanxuanSpecialId int) (count int, err error) {
- sqlCount := ` SELECT COUNT(1) AS count FROM cygx_yanxuan_special_record as a WHERE user_id= ? AND yanxuan_special_id = ? `
- o := orm.NewOrm()
- err = o.Raw(sqlCount, userId, yanxuanSpecialId).QueryRow(&count)
- return
- }
- type CygxYanxuanSpecialRecordLog struct {
- CygxYanxuanSpecialRecordId int `orm:"column(cygx_yanxuan_special_record_id);pk"`
- UserId int
- Mobile string
- Email string
- CompanyId int
- CompanyName string
- RealName string
- SellerName string
- CreateTime time.Time
- ModifyTime time.Time
- RegisterPlatform int
- YanxuanSpecialId int
- StopTime int
- PermissionCode int
- }
- func AddCygxYanxuanSpecialRecordLog(item *CygxYanxuanSpecialRecordLog) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- type LisYanxuanSpecialRecordPvResp struct {
- YanxuanSpecialId int `description:"文章ID"`
- Pv int `description:"pv"`
- Uv int `description:"pv"`
- }
- func GetCygxYanxuanSpecialRecordListPv(condition string, pars []interface{}) (items []*LisYanxuanSpecialRecordPvResp, err error) {
- o := orm.NewOrm()
- sql := `SELECT
- COUNT( 1 ) AS pv,
- yanxuan_special_id
- FROM
- cygx_yanxuan_special_record WHERE 1 = 1 `
- if condition != "" {
- sql += condition
- }
- sql += ` GROUP BY yanxuan_special_id `
- _, err = o.Raw(sql, pars).QueryRows(&items)
- return
- }
|