micro_roadshow.go 21 KB

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