micro_roadshow.go 21 KB

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