micro_roadshow.go 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. "hongze/hongze_clpt/utils"
  6. "time"
  7. )
  8. // MicroRoadShowListResp 微路演列表响应体
  9. type MicroRoadShowListResp struct {
  10. Paging *paging.PagingItem
  11. List []*MicroRoadShowPageList
  12. }
  13. type CygxMicroRoadshowVideo struct {
  14. VideoId int `orm:"column(video_id);pk"description:"微路演视频id"`
  15. VideoName string `description:"视频名称"`
  16. ChartPermissionId int `description:"行业Id"`
  17. ChartPermissionName string `description:"行业名称"`
  18. IndustryId int `description:"产业id"`
  19. IndustryName string `description:"产业名称"`
  20. PublishStatus int `description:"发布状态 1发布 0没有"`
  21. ModifyDate string `description:"更新时间"`
  22. PublishDate time.Time `description:"发布时间"`
  23. VideoDuration string `description:"视频时长"`
  24. VideoCounts int `description:"播放量"`
  25. VideoUrl string `description:"视频地址"`
  26. CreateTime string `description:"创建时间"`
  27. ImgUrl string `description:"视频封面图"`
  28. ShareImgUrl string `description:"视频分享图"`
  29. DetailImgUrl string `description:"产业详情页背景图"`
  30. CommentNum int `description:"留言总数"`
  31. IsSendWxMsg int `description:"是否推送过微信模板消息,1是,0:否"`
  32. }
  33. // MicroRoadShowPageList 微路演列表
  34. type MicroRoadShowPageList struct {
  35. Id int `description:"音视频ID"`
  36. SourceId int `description:"资源ID"`
  37. Title string `description:"标题"`
  38. ResourceUrl string `description:"链接"`
  39. Type int `description:"类型: 1-音频; 2-活动视频; 3-产业视频 、 4-系列问答视频"`
  40. LabelType int `description:"标签类型: 1-路演回放; 2-调研反馈; 3-产业视频; 4-问答系列"`
  41. ActivityFileType int `description:"活动音视频文件类型: 1-路演回放; 2-调研反馈"`
  42. PublishTime string `description:"发布时间"`
  43. BackgroundImg string `description:"背景图"`
  44. ShareImg string `description:"分享封面图"`
  45. ChartPermissionId int `description:"行业ID"`
  46. ChartPermissionName string `description:"行业名称"`
  47. IndustryName string `description:"产业名称"`
  48. PlaySeconds string `description:"音视频时长"`
  49. ActivityId int `description:"活动ID"`
  50. IsCollect bool `description:"是否收藏"`
  51. IndustrialManagementId int `description:"产业ID"`
  52. IndustryId int `description:"产业ID"`
  53. CreateTime string `description:"视频创建时间"`
  54. CollectTime time.Time `description:"收藏时间"`
  55. AuthInfo *UserPermissionAuthInfo
  56. }
  57. func GetMicroRoadshowVideoByVideoId(videoId int) (item *CygxMicroRoadshowVideo, err error) {
  58. o := orm.NewOrm()
  59. sql := `SELECT * from cygx_micro_roadshow_video where video_id = ? `
  60. err = o.Raw(sql, videoId).QueryRow(&item)
  61. return
  62. }
  63. type AddVideoHistoryReq struct {
  64. SourceId int `description:"资源ID"`
  65. PlaySeconds int `description:"播放时长"`
  66. SourceType int `description:"音视频来源: 1-活动音频; 2-活动视频; 3-产业视频; 4-系列问答"`
  67. }
  68. type CygxMicroRoadshowVideoHistory struct {
  69. Id int `orm:"column(id);pk"description:"微路演视频浏览记录表id"`
  70. VideoId int `description:"微路演视频id"`
  71. UserId int `description:"用户id"`
  72. Mobile string `description:"手机号"`
  73. Email string `description:"邮箱"`
  74. CompanyId int `description:"公司Id"`
  75. CompanyName string `description:"公司名称"`
  76. RealName string `description:"用户实际名称"`
  77. SellerName string `description:"所属销售"`
  78. PlaySeconds string `description:"播放时间 单位s"`
  79. CreateTime time.Time `description:"视频创建时间"`
  80. ModifyTime time.Time `description:"视频修改时间"`
  81. RegisterPlatform int `description:"来源 1小程序,2:网页"`
  82. }
  83. func GetLastCygxMicroRoadshowVideoHistory(videoId, userId int) (item *CygxMicroRoadshowVideoHistory, err error) {
  84. o := orm.NewOrm()
  85. sql := ` SELECT * FROM cygx_micro_roadshow_video_history WHERE video_id=? AND user_id=? ORDER BY create_time DESC limit 1 `
  86. err = o.Raw(sql, videoId, userId).QueryRow(&item)
  87. return
  88. }
  89. func AddCygxMicroRoadshowVideoHistory(item *CygxMicroRoadshowVideoHistory) (err error) {
  90. o := orm.NewOrm()
  91. _, err = o.Insert(item)
  92. return
  93. }
  94. // MicroAudioUnionList 微路演音频联合列表
  95. type MicroAudioUnionList struct {
  96. Id int `description:"音视频ID"`
  97. AudioTitle string `description:"标题"`
  98. AudioResourceUrl string `description:"链接"`
  99. AudioType int `description:"类型: 1-音频; 2-视频"`
  100. AudioPublishTime string `description:"发布时间"`
  101. AudioImgUrl string `description:"背景图"`
  102. AudioShareImg string `description:"分享图"`
  103. AudioChartPermissionId int `description:"行业ID"`
  104. AudioChartPermissionName string `description:"行业名称"`
  105. AudioPlaySeconds string `description:"音视频时长"`
  106. AudioActivityId int `description:"活动ID"`
  107. AuthInfo *UserPermissionAuthInfo
  108. }
  109. // HomeNewestUnionList 首页最新纪要-音频联合查询结果
  110. type HomeNewestUnionList struct {
  111. ArticleId int `description:"文章id"`
  112. Title string `description:"标题"`
  113. TitleEn string `description:"英文标题 "`
  114. UpdateFrequency string `description:"更新周期"`
  115. CreateDate string `description:"创建时间"`
  116. PublishDate string `description:"发布时间"`
  117. Body string `description:"内容"`
  118. BodyHtml string `description:"内容带有HTML标签"`
  119. Abstract string `description:"摘要"`
  120. CategoryName string `description:"一级分类"`
  121. SubCategoryName string `description:"二级分类"`
  122. ExpertBackground string `description:"专家背景"`
  123. IsResearch bool `description:"是否属于研选"`
  124. Pv int `description:"PV"`
  125. ImgUrlPc string `description:"图片链接"`
  126. CategoryId string `description:"文章分类"`
  127. HttpUrl string `description:"文章链接跳转地址"`
  128. IsNeedJump bool `description:"是否需要跳转链接地址"`
  129. Source int `description:"来源 1:文章, 2:图表"`
  130. Annotation string `description:"核心观点"`
  131. HomeType int `description:"数据类型:0-纪要(默认); 1-微路演音频"`
  132. MicroAudioUnionList
  133. }
  134. func UpdateLastCygxActivityVideoHistory(playSeconds string, lastId int) (err error) {
  135. o := orm.NewOrm()
  136. sql := ` UPDATE cygx_micro_roadshow_video_history SET play_seconds =? WHERE id=? `
  137. _, err = o.Raw(sql, playSeconds, lastId).Exec()
  138. return
  139. }
  140. // MicroRoadshowVideo 微路演视频
  141. type MicroRoadshowVideo struct {
  142. VideoId int `orm:"column(video_id);pk" description:"视频ID"`
  143. VideoName string `description:"视频标题"`
  144. ChartPermissionId int `description:"行业ID"`
  145. ChartPermissionName string `description:"行业名称"`
  146. IndustryId int `description:"产业ID"`
  147. IndustryName string `description:"产业名称"`
  148. PublishStatus int `description:"发布状态:0-未发布;1-已发布"`
  149. ModifyDate time.Time `description:"更新时间"`
  150. PublishDate time.Time `description:"发布时间"`
  151. VideoCounts int `description:"视频播放量"`
  152. VideoDuration int `description:"视频时长"`
  153. VideoUrl string `description:"视频地址"`
  154. CreateTime time.Time `description:"创建时间"`
  155. ImgUrl string `description:"背景图链接"`
  156. DetailImgUrl string `description:"产业详情页背景图"`
  157. }
  158. // GetMicroRoadshowVideoById 主键获取微路演视频
  159. func GetMicroRoadshowVideoById(videoId int) (item *MicroRoadshowVideo, err error) {
  160. sql := `SELECT * FROM cygx_micro_roadshow_video WHERE video_id = ? LIMIT 1`
  161. err = orm.NewOrm().Raw(sql, videoId).QueryRow(&item)
  162. return
  163. }
  164. func UpdateCygxActivityVideoCounts(videoId int) (err error) {
  165. sql := `UPDATE cygx_micro_roadshow_video SET video_counts = video_counts+1 WHERE video_id = ? `
  166. o := orm.NewOrm()
  167. _, err = o.Raw(sql, videoId).Exec()
  168. return
  169. }
  170. // GetMicroRoadshowVideoByIndustryIds 根据行业ID查询产业视频列表
  171. func GetMicroRoadshowVideoByIndustryIds(industrialIdArr []int) (list []*MicroRoadshowVideo, err error) {
  172. sql := `SELECT * FROM cygx_micro_roadshow_video WHERE industry_id in (` + utils.GetOrmInReplace(len(industrialIdArr)) + `) `
  173. _, err = orm.NewOrm().Raw(sql, industrialIdArr).QueryRows(&list)
  174. return
  175. }
  176. // GetMicroRoadshowVideoListBycondition 根据搜索条件获取搜索列表
  177. func GetMicroRoadshowVideoListBycondition(condition string, pars []interface{}, startSize, pageSize int) (list []*MicroRoadshowVideo, err error) {
  178. sql := `SELECT * FROM cygx_micro_roadshow_video WHERE 1 =1 `
  179. if condition != "" {
  180. sql += condition
  181. }
  182. sql += ` LIMIT ?,? `
  183. _, err = orm.NewOrm().Raw(sql, pars, startSize, pageSize).QueryRows(&list)
  184. return
  185. }
  186. // GetMicroRoadshowVideoByIndustryId 根据行业ID查询产业视频列表
  187. func GetMicroRoadshowVideoByIndustryId(industryId int) (item *MicroRoadshowVideo, err error) {
  188. sql := `SELECT * FROM cygx_micro_roadshow_video WHERE industry_id = ? and publish_status = 1`
  189. err = orm.NewOrm().Raw(sql, industryId).QueryRow(&item)
  190. return
  191. }
  192. // GetMicroRoadshowVideoByIndustryIdCount 根据行业ID查询产业视频是否存在
  193. func GetMicroRoadshowVideoByIndustryIdCount(industryId int) (count int, err error) {
  194. o := orm.NewOrm()
  195. sql := `SELECT COUNT(1) count
  196. FROM cygx_micro_roadshow_video WHERE industry_id = ? and publish_status = 1`
  197. err = o.Raw(sql, industryId).QueryRow(&count)
  198. return
  199. }
  200. // GetMicroRoadshowVideoByVideoIdCount 根据视频ID查询产业视频是否存在
  201. func GetMicroRoadshowVideoByVideoIdCount(industryId int) (count int, err error) {
  202. o := orm.NewOrm()
  203. sql := `SELECT COUNT(1) count
  204. FROM cygx_micro_roadshow_video WHERE video_id = ? and publish_status = 1`
  205. err = o.Raw(sql, industryId).QueryRow(&count)
  206. return
  207. }
  208. // GetMicroRoadshowVideoList 获取已经发布的微路演视频
  209. func GetMicroRoadshowVideoList() (list []*MicroRoadshowVideo, err error) {
  210. sql := `SELECT * FROM cygx_micro_roadshow_video WHERE publish_status = 1`
  211. _, err = orm.NewOrm().Raw(sql).QueryRows(&list)
  212. return
  213. }
  214. // GetMicroRoadShowVideoPageList 获取微路演视频列表-分页
  215. func GetMicroRoadShowVideoPageListV8(startSize, pageSize int, condition string, pars []interface{}, conditionAct string, parsAct []interface{}, conditionAudio string, parsAudio []interface{}, audioId, videoId, activityVideoId, filter int) (total int, list []*MicroRoadShowPageList, err error) {
  216. o := orm.NewOrm()
  217. var sql string
  218. //if audioId+activityVideoId == 0 && filter != 2 {
  219. sql += `SELECT
  220. video_id AS id,
  221. video_name AS title,
  222. video_url AS resource_url,
  223. 3 AS type,
  224. publish_date AS publish_time,
  225. chart_permission_id,
  226. chart_permission_name,
  227. video_duration AS play_seconds,
  228. img_url AS background_img,
  229. industry_name,
  230. share_img_url AS share_img,
  231. industry_id AS industrial_management_id,
  232. "" as activity_id
  233. FROM
  234. cygx_micro_roadshow_video
  235. WHERE
  236. publish_status = 1 `
  237. if condition != `` {
  238. sql += condition
  239. }
  240. //}
  241. //if audioId+videoId+activityVideoId == 0 && filter != 2 {
  242. sql += ` UNION ALL `
  243. //}
  244. //if audioId+videoId == 0 && filter != 2 {
  245. sql += `
  246. SELECT
  247. video_id AS id,
  248. video_name AS title,
  249. video_url AS resource_url,
  250. 2 AS type,
  251. art.activity_time as publish_time,
  252. art.chart_permission_id,
  253. art.chart_permission_name,
  254. "" AS play_seconds,
  255. v.background_img,
  256. "" AS industry_name,
  257. v.share_img,
  258. 0 AS industrial_management_id,
  259. v.activity_id
  260. FROM
  261. cygx_activity_video as v
  262. INNER JOIN cygx_activity as art on art.activity_id = v.activity_id WHERE 1= 1 `
  263. if conditionAct != `` {
  264. sql += conditionAct
  265. }
  266. //}
  267. //if audioId+videoId+activityVideoId == 0 && filter == 0 {
  268. sql += ` UNION ALL `
  269. //}
  270. //if videoId+activityVideoId == 0 && filter != 1 {
  271. sql += `
  272. SELECT
  273. a.activity_voice_id AS id,
  274. a.voice_name AS title,
  275. a.voice_url AS resource_url,
  276. 1 AS type,
  277. b.activity_time AS publish_time,
  278. b.chart_permission_id,
  279. b.chart_permission_name,
  280. a.voice_play_seconds AS play_seconds,
  281. a.background_img,
  282. "" AS industry_name,
  283. a.share_img,
  284. 0 AS industrial_management_id,
  285. a.activity_id
  286. FROM
  287. cygx_activity_voice AS a
  288. JOIN cygx_activity AS b ON a.activity_id = b.activity_id WHERE 1= 1 `
  289. if conditionAudio != `` {
  290. sql += conditionAudio
  291. }
  292. //}
  293. sql += ` ORDER BY publish_time DESC`
  294. totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
  295. err = o.Raw(totalSql, pars, parsAct, parsAudio).QueryRow(&total)
  296. if err != nil {
  297. return
  298. }
  299. sql += ` LIMIT ?,?`
  300. _, err = o.Raw(sql, pars, parsAct, parsAudio, startSize, pageSize).QueryRows(&list)
  301. return
  302. }
  303. // GetMicroRoadShowVideoPageList 获取微路演视频列表-分页
  304. func GetMicroRoadShowVideoPageListV12(startSize, pageSize int, audioAct string, audioActPars []interface{}, videoAct string, videoActPars []interface{}, videoMico string, videoMicoPars []interface{}, conditionAskserie string, askseriePars []interface{}) (total int, list []*MicroRoadShowPageList, err error) {
  305. o := orm.NewOrm()
  306. var sql string
  307. //活动音频1
  308. sql += `
  309. SELECT
  310. a.activity_voice_id AS id,
  311. a.activity_id AS source_id,
  312. a.voice_name AS title,
  313. a.voice_url AS resource_url,
  314. 1 AS type,
  315. b.activity_time AS publish_time,
  316. b.chart_permission_id,
  317. b.chart_permission_name,
  318. a.voice_play_seconds AS play_seconds,
  319. a.background_img,
  320. "" AS industry_name,
  321. 0 AS industry_id,
  322. a.share_img,
  323. a.file_type as activity_file_type,
  324. a.activity_id
  325. FROM
  326. cygx_activity_voice AS a
  327. JOIN cygx_activity AS b ON a.activity_id = b.activity_id WHERE 1= 1 `
  328. if audioAct != `` {
  329. sql += audioAct
  330. }
  331. //活动视频2
  332. sql += ` UNION ALL `
  333. sql += `
  334. SELECT
  335. a.video_id AS id,
  336. a.activity_id AS source_id,
  337. a.video_name AS title,
  338. a.video_url AS resource_url,
  339. 2 AS type,
  340. b.activity_time as publish_time,
  341. b.chart_permission_id,
  342. b.chart_permission_name,
  343. a.video_duration AS play_seconds,
  344. a.background_img,
  345. "" AS industry_name,
  346. 0 AS industry_id,
  347. a.share_img,
  348. a.file_type as activity_file_type,
  349. a.activity_id
  350. FROM
  351. cygx_activity_video as a
  352. INNER JOIN cygx_activity as b on a.activity_id = b.activity_id WHERE 1= 1 `
  353. if videoAct != `` {
  354. sql += videoAct
  355. }
  356. sql += ` UNION ALL `
  357. // 产业视频3
  358. sql += `SELECT
  359. video_id AS id,
  360. video_id AS source_id,
  361. video_name AS title,
  362. video_url AS resource_url,
  363. 3 AS type,
  364. publish_date AS publish_time,
  365. chart_permission_id,
  366. chart_permission_name,
  367. video_duration AS play_seconds,
  368. img_url AS background_img,
  369. industry_name,
  370. industry_id,
  371. share_img_url AS share_img,
  372. '' as activity_file_type,
  373. "" as activity_id
  374. FROM
  375. cygx_micro_roadshow_video as a
  376. WHERE
  377. publish_status = 1 `
  378. if videoMico != `` {
  379. sql += videoMico
  380. }
  381. //系列问答
  382. sql += ` UNION ALL `
  383. sql += `
  384. SELECT
  385. a.askserie_video_id AS id,
  386. a.askserie_video_id AS source_id,
  387. a.video_name AS title,
  388. a.video_url AS resource_url,
  389. 4 AS type,
  390. a.publish_date AS publish_time,
  391. a.chart_permission_id,
  392. a.chart_permission_name,
  393. a.video_duration AS play_seconds,
  394. a.background_img,
  395. "" AS industry_name,
  396. 0 AS industry_id,
  397. a.share_img,
  398. '' as activity_file_type,
  399. 0 as activity_id
  400. FROM
  401. cygx_askserie_video AS a WHERE 1= 1 `
  402. if conditionAskserie != `` {
  403. sql += conditionAskserie
  404. }
  405. sql += ` ORDER BY publish_time DESC`
  406. totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
  407. err = o.Raw(totalSql, audioActPars, videoActPars, videoMicoPars, askseriePars).QueryRow(&total)
  408. if err != nil {
  409. return
  410. }
  411. sql += ` LIMIT ?,?`
  412. _, err = o.Raw(sql, audioActPars, videoActPars, videoMicoPars, askseriePars, startSize, pageSize).QueryRows(&list)
  413. return
  414. }
  415. type MicroList []*MicroRoadShowPageList
  416. func (m MicroList) Len() int {
  417. return len(m)
  418. }
  419. func (m MicroList) Less(i, j int) bool {
  420. return m[i].CollectTime.After(m[j].CollectTime)
  421. }
  422. func (m MicroList) Swap(i, j int) {
  423. m[i], m[j] = m[j], m[i]
  424. }
  425. // CountMicroRoadShowVideoPageList 获取微路演视频数量
  426. func CountMicroRoadShowVideoPageList(condition string, pars []interface{}, conditionAct string, parsAct []interface{}, conditionAudio string, parsAudio []interface{}) (total int, err error) {
  427. o := orm.NewOrm()
  428. var sql string
  429. sql += `SELECT
  430. video_id AS id,
  431. video_name AS title,
  432. video_url AS resource_url,
  433. 3 AS type,
  434. publish_date AS publish_time,
  435. chart_permission_id,
  436. chart_permission_name,
  437. video_duration AS play_seconds,
  438. img_url AS background_img,
  439. industry_name,
  440. share_img_url AS share_img,
  441. "" as activity_id
  442. FROM
  443. cygx_micro_roadshow_video
  444. WHERE
  445. publish_status = 1 `
  446. if condition != `` {
  447. sql += condition
  448. }
  449. sql += ` UNION ALL `
  450. sql += `
  451. SELECT
  452. video_id AS id,
  453. video_name AS title,
  454. video_url AS resource_url,
  455. 2 AS type,
  456. art.activity_time as publish_time,
  457. art.chart_permission_id,
  458. art.chart_permission_name,
  459. "" AS play_seconds,
  460. v.background_img,
  461. "" AS industry_name,
  462. v.share_img,
  463. v.activity_id
  464. FROM
  465. cygx_activity_video as v
  466. INNER JOIN cygx_activity as art on art.activity_id = v.activity_id WHERE 1= 1 `
  467. if conditionAct != `` {
  468. sql += conditionAct
  469. }
  470. sql += ` UNION ALL `
  471. sql += `
  472. SELECT
  473. a.activity_voice_id AS id,
  474. a.voice_name AS title,
  475. a.voice_url AS resource_url,
  476. 1 AS type,
  477. b.activity_time AS publish_time,
  478. b.chart_permission_id,
  479. b.chart_permission_name,
  480. a.voice_play_seconds AS play_seconds,
  481. a.background_img,
  482. "" AS industry_name,
  483. a.share_img,
  484. a.activity_id
  485. FROM
  486. cygx_activity_voice AS a
  487. JOIN cygx_activity AS b ON a.activity_id = b.activity_id WHERE 1= 1 `
  488. if conditionAudio != `` {
  489. sql += conditionAudio
  490. }
  491. sql += ` ORDER BY publish_time DESC`
  492. totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z `
  493. err = o.Raw(totalSql, pars, parsAct, parsAudio).QueryRow(&total)
  494. return
  495. }
  496. // GetMicroRoadShowVideoPageList 获取微路演视频列表-分页
  497. func GetMicroRoadShowVideoPageListIkWord(startSize, pageSize int, condition string, pars []interface{}, conditionAct string, parsAct []interface{}, conditionAudio string, parsAudio []interface{}, audioId, videoId, activityVideoId, filter int) (list []*MicroRoadShowPageList, err error) {
  498. o := orm.NewOrm()
  499. var sql string
  500. //if audioId+activityVideoId == 0 && filter != 2 {
  501. sql += `SELECT
  502. video_id AS id,
  503. video_name AS title,
  504. video_url AS resource_url,
  505. 3 AS type,
  506. publish_date AS publish_time,
  507. chart_permission_id,
  508. chart_permission_name,
  509. video_duration AS play_seconds,
  510. img_url AS background_img,
  511. industry_name,
  512. industry_id AS industrial_management_id,
  513. share_img_url AS share_img,
  514. "" as activity_id
  515. FROM
  516. cygx_micro_roadshow_video
  517. WHERE
  518. publish_status = 1 `
  519. if condition != `` {
  520. sql += condition
  521. }
  522. //}
  523. //if audioId+videoId+activityVideoId == 0 && filter != 2 {
  524. // sql += ` UNION ALL `
  525. //}
  526. sql += ` UNION ALL `
  527. //if audioId+videoId == 0 && filter != 2 {
  528. sql += `
  529. SELECT
  530. video_id AS id,
  531. video_name AS title,
  532. video_url AS resource_url,
  533. 2 AS type,
  534. art.activity_time as publish_time,
  535. art.chart_permission_id,
  536. art.chart_permission_name,
  537. "" AS play_seconds,
  538. v.background_img,
  539. "" AS industry_name,
  540. 0 AS industrial_management_id,
  541. v.share_img,
  542. v.activity_id
  543. FROM
  544. cygx_activity_video as v
  545. INNER JOIN cygx_activity as art on art.activity_id = v.activity_id WHERE 1= 1 `
  546. if conditionAct != `` {
  547. sql += conditionAct
  548. }
  549. //}
  550. //if audioId+videoId+activityVideoId == 0 && filter == 0 {
  551. // sql += ` UNION ALL `
  552. //}
  553. sql += ` UNION ALL `
  554. //if videoId+activityVideoId == 0 && filter != 1 {
  555. sql += `
  556. SELECT
  557. a.activity_voice_id AS id,
  558. a.voice_name AS title,
  559. a.voice_url AS resource_url,
  560. 1 AS type,
  561. b.activity_time AS publish_time,
  562. b.chart_permission_id,
  563. b.chart_permission_name,
  564. a.voice_play_seconds AS play_seconds,
  565. a.background_img,
  566. "" AS industry_name,
  567. 0 AS industrial_management_id,
  568. a.share_img,
  569. a.activity_id
  570. FROM
  571. cygx_activity_voice AS a
  572. JOIN cygx_activity AS b ON a.activity_id = b.activity_id WHERE 1= 1 `
  573. if conditionAudio != `` {
  574. sql += conditionAudio
  575. }
  576. //}
  577. sql += ` ORDER BY publish_time DESC`
  578. sql += ` LIMIT ?,?`
  579. _, err = o.Raw(sql, pars, parsAct, parsAudio, startSize, pageSize).QueryRows(&list)
  580. return
  581. }
  582. type AddVideoCommnetReq struct {
  583. //Id int `description:"活动或产业ID"`
  584. SourceId int `description:"资源ID"`
  585. SourceType int `description:"视频来源: 1-音频; 2-活动视频; 3-微路演视频 (不传默认为1)"`
  586. Content string `description:"内容"`
  587. Title string `description:"标题"`
  588. }
  589. type MicroRoadshowCollectReq struct {
  590. //Id int `description:"音频或视频ID"`
  591. SourceId int `description:"资源ID"`
  592. SourceType int `description:"视频来源: 1-音频; 2-活动视频; 3-微路演视频 (不传默认为1)"`
  593. }