123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "github.com/rdlucklib/rdluck_tools/paging"
- "time"
- )
- // MicroRoadShowListResp 微路演列表响应体
- type MicroRoadShowListResp struct {
- Paging *paging.PagingItem
- List []*MicroRoadShowPageList
- }
- // MicroRoadShowPageList 微路演列表
- type MicroRoadShowPageList struct {
- Id int `description:"音视频ID"`
- Title string `description:"标题"`
- ResourceUrl string `description:"链接"`
- Type int `description:"类型: 1-音频; 2-视频"`
- PublishTime string `description:"发布时间"`
- BackgroundImg string `description:"背景图"`
- ChartPermissionId int `description:"行业ID"`
- ChartPermissionName string `description:"行业名称"`
- PlaySeconds string `description:"音视频时长"`
- ActivityId int `description:"活动ID"`
- AuthInfo *UserPermissionAuthInfo
- }
- // GetMicroRoadShowAudioPageList 获取微路演音频列表-分页
- func GetMicroRoadShowAudioPageList(startSize, pageSize int, condition string, pars []interface{}) (total int, list []*MicroRoadShowPageList, err error) {
- o := orm.NewOrm()
- sql := `SELECT
- a.activity_voice_id AS id,
- a.voice_name AS title,
- a.voice_url AS resource_url,
- 1 AS type,
- b.activity_time AS publish_time,
- b.chart_permission_id,
- b.chart_permission_name,
- a.voice_play_seconds AS play_seconds,
- a.img_url AS background_img,
- a.activity_id
- FROM
- cygx_activity_voice AS a
- JOIN cygx_activity AS b ON a.activity_id = b.activity_id `
- if condition != `` {
- sql += condition
- }
- sql += ` ORDER BY publish_time DESC`
- totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
- err = o.Raw(totalSql, pars).QueryRow(&total)
- if err != nil {
- return
- }
- sql += ` LIMIT ?,?`
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&list)
- return
- }
- // GetMicroRoadShowVideoPageList 获取微路演视频列表-分页
- func GetMicroRoadShowVideoPageList(startSize, pageSize int, condition string, pars []interface{}) (total int, list []*MicroRoadShowPageList, err error) {
- o := orm.NewOrm()
- sql := `SELECT
- video_id AS id,
- video_name AS title,
- video_url AS resource_url,
- 2 AS type,
- publish_date AS publish_time,
- chart_permission_id,
- chart_permission_name,
- video_duration AS play_seconds,
- img_url AS background_img
- FROM
- cygx_micro_roadshow_video
- WHERE
- publish_status = 1 `
- if condition != `` {
- sql += condition
- }
- sql += ` ORDER BY publish_time DESC`
- totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
- err = o.Raw(totalSql, pars).QueryRow(&total)
- if err != nil {
- return
- }
- sql += ` LIMIT ?,?`
- _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&list)
- return
- }
- type AddVideoHistoryReq struct {
- VideoId int `description:"视频ID"`
- PlaySeconds string `description:"播放时长"`
- }
- type CygxMicroRoadshowVideoHistory struct {
- Id int `orm:"column(id);pk"description:"微路演视频浏览记录表id"`
- VideoId int `description:"微路演视频id"`
- UserId int `description:"用户id"`
- Mobile string `description:"手机号"`
- Email string `description:"邮箱"`
- CompanyId int `description:"公司Id"`
- CompanyName string `description:"公司名称"`
- RealName string `description:"用户实际名称"`
- SellerName string `description:"所属销售"`
- PlaySeconds string `description:"播放时间 单位s"`
- CreateTime time.Time `description:"视频创建时间"`
- ModifyTime time.Time `description:"视频修改时间"`
- }
- func GetLastCygxMicroRoadshowVideoHistory(videoId int) (item *CygxMicroRoadshowVideoHistory, err error) {
- o := orm.NewOrm()
- sql := ` SELECT * FROM cygx_micro_roadshow_video_history WHERE video_id=? ORDER BY create_time DESC limit 1 `
- err = o.Raw(sql, videoId).QueryRow(&item)
- return
- }
- func AddCygxMicroRoadshowVideoHistory(item *CygxMicroRoadshowVideoHistory) (err error) {
- o := orm.NewOrm()
- _, err = o.Insert(item)
- return
- }
|