researchSummary.go 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type DetailCygxResearchSummaryRep struct {
  7. ArticleId int `description:"报告Id"`
  8. Title string `description:"标题"`
  9. Department string `description:"作者"`
  10. PublishDate string `description:"发布时间"`
  11. VideoUrl string `description:"链接"`
  12. VideoPlaySeconds string `description:"时长"`
  13. VideoName string `description:"音频名称"`
  14. Abstract string `description:"摘要"`
  15. VisibleRange int `description:"设置可见范围1全部,0内部"`
  16. }
  17. type ResearchSummaryLetailResp struct {
  18. Detail *DetailCygxResearchSummaryRep
  19. HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
  20. List []*ResearchSummaryChartPermission
  21. IsShow bool `description:"是否展示"`
  22. }
  23. type ResearchSummaryChartPermission struct {
  24. ListName string `description:"列表名称"`
  25. IcoLink string `orm:"column(image_url)"description:"图标链接"`
  26. Type string `description:"类型'SDBG深度报告片篇,’CYDYJY:产业调研纪要’,’SJDP事件点评,’BZCHJH:本周晨会精华’"`
  27. List []*CygxResearchSummaryLogSecond
  28. }
  29. type CygxResearchSummaryLogSecond struct {
  30. PermissionName string `description:"行业名称"`
  31. ChartPermissionId int `description:"行业ID"`
  32. IcoLink string `orm:"column(image_url)"description:"图标链接"`
  33. List []*CygxResearchSummaryLogThird
  34. }
  35. type CygxResearchSummaryLogThird struct {
  36. Body string `description:"内容"`
  37. ReportLink string `orm:"column(link_article_id)"description:"报告链接"`
  38. VideoUrl string `description:"链接"`
  39. IsHaveVideo bool `description:"是否含有音频文件"`
  40. }
  41. type IndustriaResearchSummary struct {
  42. IndustrialManagementId int `description:"产业Id"`
  43. IndustryName string `description:"产业名称"`
  44. }
  45. type ResearchSummaryId struct {
  46. ArticleId int `description:"报告I"`
  47. }
  48. // 通过纪要ID获取详情
  49. func GetCygxResearchSummaryInfoById(articleId int) (item *DetailCygxResearchSummaryRep, err error) {
  50. o := orm.NewOrm()
  51. sql := `SELECT * FROM cygx_research_summary WHERE article_id=? AND publish_status = 1 `
  52. err = o.Raw(sql, articleId).QueryRow(&item)
  53. return
  54. }
  55. type CygxResearchSummaryLog struct {
  56. ArticleSunId int `description:"子级报告id"`
  57. ArticleId int `description:"父级报告Id"`
  58. ChartPermissionId int `description:"行业ID"`
  59. PermissionName string `description:"行业ID"`
  60. CreateTime time.Time `description:"创建时间"`
  61. Body string `description:"内容"`
  62. IndustrialSubjectId string `description:"标的ID"`
  63. IndustrialManagementId string `description:"产业资源包Id 多个用 , 隔开"`
  64. SubjectName string `description:"标的名称"`
  65. Type string `description:"类型'SDBG深度报告片篇,’CYDYJY:产业调研纪要’,’SJDP事件点评,’BZCHJH:本周晨会精华’"`
  66. }
  67. // 列表
  68. func GetResearchSummarylogListFirst(articleId int) (items []*ResearchSummaryChartPermission, err error) {
  69. o := orm.NewOrm()
  70. sql := `SELECT l.*
  71. FROM cygx_research_summary_log AS l
  72. WHERE l.article_id = ?
  73. GROUP BY l.type
  74. ORDER BY l.sort ASC`
  75. _, err = o.Raw(sql, articleId).QueryRows(&items)
  76. return
  77. }
  78. // 列表
  79. func GetResearchSummarylogSonListSecond(articleId int, artType string) (items []*CygxResearchSummaryLogSecond, err error) {
  80. o := orm.NewOrm()
  81. sql := `SELECT l.*
  82. FROM
  83. cygx_research_summary_log AS l
  84. WHERE l.article_id = ? AND l.type =?
  85. GROUP BY l.chart_permission_id
  86. ORDER BY l.chart_permission_sort ASC`
  87. _, err = o.Raw(sql, articleId, artType).QueryRows(&items)
  88. return
  89. }
  90. // 列表
  91. func GetResearchSummarylogSonListThird(articleId, chartPermissionId int, artType string) (items []*CygxResearchSummaryLogThird, err error) {
  92. o := orm.NewOrm()
  93. sql := `SELECT l.link_article_id,l.body ,a.video_url
  94. FROM cygx_research_summary_log AS l
  95. LEFT JOIN cygx_article as a ON a.article_id = l.link_article_id
  96. WHERE l.article_id = ? AND l.type =? AND l.chart_permission_id = ?
  97. ORDER BY l.chart_permission_sort ASC `
  98. _, err = o.Raw(sql, articleId, artType, chartPermissionId).QueryRows(&items)
  99. return
  100. }
  101. func UpdateResearchSummaryVoiceCounts(articleId int) (err error) {
  102. sql := `UPDATE cygx_research_summary SET voice_counts = voice_counts+1 WHERE article_id = ? `
  103. o := orm.NewOrm()
  104. _, err = o.Raw(sql, articleId).Exec()
  105. return
  106. }
  107. func UpdateMinutesSummaryVoiceCounts(articleId int) (err error) {
  108. sql := `UPDATE cygx_minutes_summary SET voice_counts = voice_counts+1 WHERE article_id = ? `
  109. o := orm.NewOrm()
  110. _, err = o.Raw(sql, articleId).Exec()
  111. return
  112. }
  113. func UpdateReportSelectionVoiceCounts(articleId int) (err error) {
  114. sql := `UPDATE cygx_report_selection SET voice_counts = voice_counts+1 WHERE article_id = ? `
  115. o := orm.NewOrm()
  116. _, err = o.Raw(sql, articleId).Exec()
  117. return
  118. }