micro_roadshow.go 22 KB

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