|
@@ -3,6 +3,7 @@ package models
|
|
|
import (
|
|
|
"github.com/beego/beego/v2/client/orm"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
+ "hongze/hongze_cygx/utils"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
@@ -17,122 +18,18 @@ type MicroRoadShowPageList struct {
|
|
|
Id int `description:"音视频ID"`
|
|
|
Title string `description:"标题"`
|
|
|
ResourceUrl string `description:"链接"`
|
|
|
- Type int `description:"类型: 1-音频; 2-视频"`
|
|
|
+ Type int `description:"类型: 1-音频; 2-活动视频; 3-产业视频"`
|
|
|
PublishTime string `description:"发布时间"`
|
|
|
BackgroundImg string `description:"背景图"`
|
|
|
ShareImg string `description:"分享封面图"`
|
|
|
ChartPermissionId int `description:"行业ID"`
|
|
|
ChartPermissionName string `description:"行业名称"`
|
|
|
+ IndustryName 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
|
|
|
- WHERE 1 = 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
|
|
|
-}
|
|
|
-
|
|
|
-// GetMicroRoadShowAudioTotal 获取微路演音频数量
|
|
|
-func GetMicroRoadShowAudioTotal(condition string, pars []interface{}) (total int, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
- sql := `SELECT
|
|
|
- a.activity_id
|
|
|
- FROM
|
|
|
- cygx_activity_voice AS a
|
|
|
- JOIN cygx_activity AS b ON a.activity_id = b.activity_id
|
|
|
- WHERE 1 = 1 `
|
|
|
- if condition != `` {
|
|
|
- sql += condition
|
|
|
- }
|
|
|
- totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
|
|
|
- err = o.Raw(totalSql, pars).QueryRow(&total)
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// GetMicroRoadShowVideoPageList 获取微路演视频列表-分页
|
|
|
-func GetMicroRoadShowVideoPageList(startSize, pageSize int, condition string, pars []interface{}, conditionAct string, parsAct []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,
|
|
|
- "" as activity_id
|
|
|
- FROM
|
|
|
- cygx_micro_roadshow_video
|
|
|
- WHERE
|
|
|
- publish_status = 1 `
|
|
|
- if condition != `` {
|
|
|
- sql += condition
|
|
|
- }
|
|
|
- sql += ` UNION ALL
|
|
|
- SELECT
|
|
|
- video_id AS id,
|
|
|
- video_name AS title,
|
|
|
- video_url AS resource_url,
|
|
|
- 2 AS type,
|
|
|
- art.activity_time as publish_time,
|
|
|
- art.chart_permission_id,
|
|
|
- art.chart_permission_name,
|
|
|
- "",
|
|
|
- "",
|
|
|
- v.activity_id
|
|
|
- FROM
|
|
|
- cygx_activity_video as v
|
|
|
- INNER JOIN cygx_activity as art on art.activity_id = v.activity_id WHERE 1= 1 `
|
|
|
- if conditionAct != `` {
|
|
|
- sql += conditionAct
|
|
|
- }
|
|
|
- sql += ` ORDER BY publish_time DESC`
|
|
|
- //totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
|
|
|
- //err = o.Raw(totalSql, pars, parsAct).QueryRow(&total)
|
|
|
- //if err != nil {
|
|
|
- // return
|
|
|
- //}
|
|
|
-
|
|
|
- sql += ` LIMIT ?,?`
|
|
|
- _, err = o.Raw(sql, pars, parsAct, startSize, pageSize).QueryRows(&list)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
// GetMicroRoadShowVideoPageList 获取微路演视频列表-分页
|
|
|
func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string, pars []interface{}, conditionAct string, parsAct []interface{}, conditionAudio string, parsAudio []interface{}, audioId, videoId, activityVideoId int) (total int, list []*MicroRoadShowPageList, err error) {
|
|
|
o := orm.NewOrm()
|
|
@@ -142,12 +39,14 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
|
|
|
video_id AS id,
|
|
|
video_name AS title,
|
|
|
video_url AS resource_url,
|
|
|
- 2 AS type,
|
|
|
+ 3 AS type,
|
|
|
publish_date AS publish_time,
|
|
|
chart_permission_id,
|
|
|
chart_permission_name,
|
|
|
+ industry_name,
|
|
|
video_duration AS play_seconds,
|
|
|
img_url AS background_img,
|
|
|
+ share_img_url AS share_img,
|
|
|
"" as activity_id
|
|
|
FROM
|
|
|
cygx_micro_roadshow_video
|
|
@@ -173,6 +72,8 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
|
|
|
art.chart_permission_name,
|
|
|
"" AS play_seconds,
|
|
|
"" AS background_img,
|
|
|
+ "" AS share_img,
|
|
|
+ "" AS industry_name,
|
|
|
v.activity_id
|
|
|
FROM
|
|
|
cygx_activity_video as v
|
|
@@ -197,6 +98,8 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
|
|
|
b.chart_permission_name,
|
|
|
a.voice_play_seconds AS play_seconds,
|
|
|
a.img_url AS background_img,
|
|
|
+ "" AS share_img,
|
|
|
+ "" AS industry_name,
|
|
|
a.activity_id
|
|
|
FROM
|
|
|
cygx_activity_voice AS a
|
|
@@ -216,51 +119,6 @@ func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string,
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-// GetMicroRoadShowVideoTotal 获取微路演视频总量
|
|
|
-func GetMicroRoadShowVideoTotal(condition string, pars []interface{}, conditionAct string, parsAct []interface{}) (total int, 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,
|
|
|
- "" as activity_id
|
|
|
- FROM
|
|
|
- cygx_micro_roadshow_video
|
|
|
- WHERE
|
|
|
- publish_status = 1 `
|
|
|
- if condition != `` {
|
|
|
- sql += condition
|
|
|
- }
|
|
|
- sql += ` UNION ALL
|
|
|
- SELECT
|
|
|
- video_id AS id,
|
|
|
- video_name AS title,
|
|
|
- video_url AS resource_url,
|
|
|
- 2 AS type,
|
|
|
- art.activity_time as publish_time,
|
|
|
- art.chart_permission_id,
|
|
|
- art.chart_permission_name,
|
|
|
- "",
|
|
|
- "",
|
|
|
- v.activity_id
|
|
|
- FROM
|
|
|
- cygx_activity_video as v
|
|
|
- INNER JOIN cygx_activity as art on art.activity_id = v.activity_id WHERE 1= 1 `
|
|
|
- if conditionAct != `` {
|
|
|
- sql += conditionAct
|
|
|
- }
|
|
|
- sql += ` ORDER BY publish_time DESC`
|
|
|
- totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
|
|
|
- err = o.Raw(totalSql, pars, parsAct).QueryRow(&total)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
type AddVideoHistoryReq struct {
|
|
|
VideoId int `description:"视频ID"`
|
|
|
PlaySeconds int `description:"播放时长"`
|
|
@@ -416,6 +274,7 @@ type MicroRoadshowVideo struct {
|
|
|
VideoUrl string `description:"视频地址"`
|
|
|
CreateTime time.Time `description:"创建时间"`
|
|
|
ImgUrl string `description:"背景图链接"`
|
|
|
+ DetailImgUrl string `description:"产业详情页背景图"`
|
|
|
}
|
|
|
|
|
|
// GetMicroRoadshowVideoById 主键获取微路演视频
|
|
@@ -431,3 +290,17 @@ func UpdateCygxActivityVideoCounts(activityId int) (err error) {
|
|
|
_, err = o.Raw(sql, activityId).Exec()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// GetMicroRoadshowVideoByIndustryIds 根据行业ID查询产业视频列表
|
|
|
+func GetMicroRoadshowVideoByIndustryIds(industrialIdArr []int) (list []*MicroRoadshowVideo, err error) {
|
|
|
+ sql := `SELECT * FROM cygx_micro_roadshow_video WHERE industry_id in (` + utils.GetOrmInReplace(len(industrialIdArr)) + `) and publish_status = 1 `
|
|
|
+ _, err = orm.NewOrm().Raw(sql, industrialIdArr).QueryRows(&list)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// GetMicroRoadshowVideoByIndustryId 根据行业ID查询产业视频列表
|
|
|
+func GetMicroRoadshowVideoByIndustryId(industryId int) (item *MicroRoadshowVideo, err error) {
|
|
|
+ sql := `SELECT * FROM cygx_micro_roadshow_video WHERE industry_id = ? and publish_status = 1`
|
|
|
+ err = orm.NewOrm().Raw(sql, industryId).QueryRow(&item)
|
|
|
+ return
|
|
|
+}
|