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 // 用户ID
- Mobile string // 手机号
- Email string // 邮箱
- CompanyId int // 公司ID
- CompanyName string // 公司名称
- RealName string // 用户实际名称
- SellerName string // 所属销售
- CreateTime time.Time // 创建时间
- ModifyTime time.Time // 修改时间
- RegisterPlatform int // 来源 1小程序,2:网页
- YanxuanSpecialId int // cygx_yanxuan_special 表主键ID
- StopTime int // 停留时间
- PermissionCode int // 权限状态,1:有权限,0:无权限
- }
- 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
- }
- // 详细日志记录,不过滤时长小于 3 秒的那种
- type CygxYanxuanSpecialRecordLog struct {
- CygxYanxuanSpecialRecordId int `orm:"column(cygx_yanxuan_special_record_id);pk"`
- UserId int // 用户ID
- Mobile string // 手机号
- Email string // 邮箱
- CompanyId int // 公司ID
- CompanyName string // 公司名称
- RealName string // 用户实际名称
- SellerName string // 所属销售
- CreateTime time.Time // 创建时间
- ModifyTime time.Time // 修改时间
- RegisterPlatform int // 来源 1小程序,2:网页
- YanxuanSpecialId int // cygx_yanxuan_special 表主键ID
- StopTime int // 停留时间
- PermissionCode int // 权限状态,1:有权限,0:无权限
- }
- 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"`
- }
- // 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
- }
|