|
@@ -30,99 +30,9 @@ type MicroRoadShowPageList struct {
|
|
|
AuthInfo *UserPermissionAuthInfo
|
|
|
}
|
|
|
|
|
|
-// 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()
|
|
|
- var sql string
|
|
|
- if audioId+activityVideoId == 0 {
|
|
|
- sql += `SELECT
|
|
|
- video_id AS id,
|
|
|
- video_name AS title,
|
|
|
- video_url AS resource_url,
|
|
|
- 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
|
|
|
- WHERE
|
|
|
- publish_status = 1 `
|
|
|
- if condition != `` {
|
|
|
- sql += condition
|
|
|
- }
|
|
|
- }
|
|
|
- if audioId+videoId+activityVideoId == 0 {
|
|
|
- sql += ` UNION ALL `
|
|
|
- }
|
|
|
-
|
|
|
- if audioId+videoId == 0 {
|
|
|
- sql += `
|
|
|
- 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,
|
|
|
- "" AS play_seconds,
|
|
|
- "" AS background_img,
|
|
|
- "" AS share_img,
|
|
|
- "" AS industry_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
|
|
|
- }
|
|
|
- }
|
|
|
- if audioId+videoId+activityVideoId == 0 {
|
|
|
- sql += ` UNION ALL `
|
|
|
- }
|
|
|
-
|
|
|
- if videoId+activityVideoId == 0 {
|
|
|
- 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,
|
|
|
- "" AS share_img,
|
|
|
- "" AS industry_name,
|
|
|
- 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 conditionAudio != `` {
|
|
|
- sql += conditionAudio
|
|
|
- }
|
|
|
- }
|
|
|
- sql += ` ORDER BY publish_time DESC`
|
|
|
- totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
|
|
|
- err = o.Raw(totalSql, pars, parsAct, parsAudio).QueryRow(&total)
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
- }
|
|
|
- sql += ` LIMIT ?,?`
|
|
|
- _, err = o.Raw(sql, pars, parsAct, parsAudio, startSize, pageSize).QueryRows(&list)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
type AddVideoHistoryReq struct {
|
|
|
VideoId int `description:"视频ID"`
|
|
|
PlaySeconds int `description:"播放时长"`
|
|
|
- SourceType int `description:"视频来源: 1-微路演; 2-活动 (不传默认为1)"`
|
|
|
}
|
|
|
|
|
|
type CygxMicroRoadshowVideoHistory struct {
|
|
@@ -195,62 +105,6 @@ type HomeNewestUnionList struct {
|
|
|
MicroAudioUnionList
|
|
|
}
|
|
|
|
|
|
-// GetHomeNewestListUnionList 首页最新纪要-音频联合查询
|
|
|
-func GetHomeNewestListUnionList(condition string, pars []interface{}, startSize, pageSize int) (list []*HomeNewestUnionList, err error) {
|
|
|
- sql := `SELECT
|
|
|
- id, article_id, title, title_en, update_frequency, create_date, publish_date, body, abstract, category_name, sub_category_name, expert_background, category_id, source, annotation,
|
|
|
- (SELECT count(1) FROM cygx_article_history_record_newpv as h WHERE h.article_id = art.article_id ) as pv,
|
|
|
- 0 AS home_type, "" AS audio_title, "" AS audio_resource_url, 0 AS audio_type, "" AS audio_publish_time, 0 AS audio_chart_permission_id, "" AS audio_chart_permission_name,
|
|
|
- "" AS audio_play_seconds, "" AS audio_img_url, 0 AS audio_activity_id
|
|
|
- FROM
|
|
|
- cygx_article AS art
|
|
|
- WHERE
|
|
|
- art.publish_status = 1 `
|
|
|
- if condition != `` {
|
|
|
- sql += condition
|
|
|
- }
|
|
|
- sql += ` UNION ALL
|
|
|
-
|
|
|
- SELECT
|
|
|
- a.activity_voice_id, 0, "", "", "", "", b.activity_time, "", "", "", "", "", 0, 0, "",
|
|
|
- 0, 1, a.voice_name, a.voice_url, 1, b.activity_time,
|
|
|
- b.chart_permission_id, b.chart_permission_name, a.voice_play_seconds AS audio_play_seconds, a.img_url AS audio_img_url, a.activity_id AS audio_activity_id
|
|
|
- FROM
|
|
|
- cygx_activity_voice AS a
|
|
|
- JOIN cygx_activity AS b ON a.activity_id = b.activity_id`
|
|
|
- sql += ` ORDER BY publish_date DESC`
|
|
|
- sql += ` LIMIT ?,?`
|
|
|
- _, err = orm.NewOrm().Raw(sql, pars, startSize, pageSize).QueryRows(&list)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
-// GetHomeNewestListUnionCount 首页最新纪要-音频联合查询总数
|
|
|
-func GetHomeNewestListUnionCount(condition string, pars []interface{}) (count int, err error) {
|
|
|
- o := orm.NewOrm()
|
|
|
- sql := `SELECT
|
|
|
- COUNT(1) AS count
|
|
|
- FROM
|
|
|
- (
|
|
|
- SELECT
|
|
|
- art.id
|
|
|
- FROM
|
|
|
- cygx_article AS art
|
|
|
- WHERE
|
|
|
- art.publish_status = 1 `
|
|
|
- if condition != `` {
|
|
|
- sql += condition
|
|
|
- }
|
|
|
- sql += ` UNION ALL
|
|
|
- SELECT
|
|
|
- a.activity_voice_id
|
|
|
- FROM
|
|
|
- cygx_activity_voice AS a
|
|
|
- JOIN cygx_activity AS b ON a.activity_id = b.activity_id
|
|
|
- ) z `
|
|
|
- err = o.Raw(sql, pars).QueryRow(&count)
|
|
|
- return
|
|
|
-}
|
|
|
-
|
|
|
func UpdateLastCygxActivityVideoHistory(playSeconds string, lastId int) (err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := ` UPDATE cygx_micro_roadshow_video_history SET play_seconds =? WHERE id=? `
|
|
@@ -284,16 +138,16 @@ func GetMicroRoadshowVideoById(videoId int) (item *MicroRoadshowVideo, err error
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-func UpdateCygxActivityVideoCounts(activityId int) (err error) {
|
|
|
+func UpdateCygxActivityVideoCounts(videoId int) (err error) {
|
|
|
sql := `UPDATE cygx_micro_roadshow_video SET video_counts = video_counts+1 WHERE video_id = ? `
|
|
|
o := orm.NewOrm()
|
|
|
- _, err = o.Raw(sql, activityId).Exec()
|
|
|
+ _, err = o.Raw(sql, videoId).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 `
|
|
|
+ sql := `SELECT * FROM cygx_micro_roadshow_video WHERE industry_id in (` + utils.GetOrmInReplace(len(industrialIdArr)) + `) `
|
|
|
_, err = orm.NewOrm().Raw(sql, industrialIdArr).QueryRows(&list)
|
|
|
return
|
|
|
}
|
|
@@ -313,3 +167,12 @@ func GetMicroRoadshowVideoByIndustryIdCount(industryId int) (count int, err erro
|
|
|
err = o.Raw(sql, industryId).QueryRow(&count)
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+//GetMicroRoadshowVideoByVidoeIdCount 根据行业ID查询产业视频是否存在
|
|
|
+func GetMicroRoadshowVideoByVidoeIdCount(industryId int) (count int, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT COUNT(1) count
|
|
|
+ FROM cygx_micro_roadshow_video WHERE video_id = ? `
|
|
|
+ err = o.Raw(sql, industryId).QueryRow(&count)
|
|
|
+ return
|
|
|
+}
|