micro_roadshow.go 22 KB

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