1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CygxAskserieVideoHistoryRecord struct {
- Id int `orm:"column(id);pk"`
- AskserieVideoId int `description:"askserie_video_id"`
- UserId int `description:"用户ID"`
- CreateTime time.Time `description:"创建时间"`
- Mobile string `description:"手机号"`
- Email string `description:"邮箱"`
- CompanyId int `description:"公司id"`
- CompanyName string `description:"公司名称"`
- RealName string `description:"用户实际名称"`
- SellerName string `description:"所属销售"`
- RegisterPlatform int `description:"来源 1小程序,2:网页"`
- ModifyTime time.Time `description:"更新时间"`
- VideoDuration int `description:"播放时长"`
- }
- // 添加
- func AddCygxAskserieVideoHistoryRecord(item *CygxAskserieVideoHistoryRecord) (err error) {
- o := orm.NewOrm()
- _, err = o.Insert(item)
- return
- }
- func UpdateAskserieVideoCounts(askserieVideoId int) (err error) {
- sql := `UPDATE cygx_askserie_video SET video_counts = video_counts+1 WHERE askserie_video_id = ? `
- o := orm.NewOrm()
- _, err = o.Raw(sql, askserieVideoId).Exec()
- return
- }
- func GetLastCygxAskserieVideoHistoryRecord(activityId, userId int) (item *CygxActivityVoiceHistory, err error) {
- o := orm.NewOrm()
- sql := ` SELECT * FROM cygx_askserie_video_history_record WHERE askserie_video_id=? AND user_id=? AND register_platform = 1 ORDER BY create_time DESC limit 1 `
- err = o.Raw(sql, activityId, userId).QueryRow(&item)
- return
- }
- func UpdateLastCygxAskserieVideoHistoryRecord(playSeconds string, lastId int) (err error) {
- o := orm.NewOrm()
- sql := ` UPDATE cygx_askserie_video_history_record SET video_duration = video_duration+? WHERE id=? `
- _, err = o.Raw(sql, playSeconds, lastId).Exec()
- return
- }
|