report.go 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. package ficc_report
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type ReportDetail struct {
  7. ReportInfo *ReportItem `json:"report_info"`
  8. ReportChapterList []*ReportChapterListItem `json:"report_chapter_list"`
  9. AuthOk bool `json:"auth_ok"`
  10. LikeNum int64 `description:"点赞总数" json:"like_num"`
  11. LikeEnabled int8 `description:"是否已点赞: 0-未点赞 1-已点赞" json:"like_enabled"`
  12. ReportShowType int `description:"展示形式:1-列表 2-专栏" json:"report_show_type"`
  13. CollectionId int `description:"收藏ID: 大于0则表示已收藏" json:"collection_id"`
  14. RoadVideoId int `json:"road_video_id" description:"绑定的路演视频ID"`
  15. ReportDetailShowType int `description:"报告详情的展示类型:1-拼接;2:目录" json:"report_detail_show_type"`
  16. HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
  17. Mobile string `description:"用户手机号"`
  18. SellerMobile string `description:"销售电话"`
  19. SellerName string `description:"销售姓名"`
  20. }
  21. type ReportChapterListItem struct {
  22. ReportChapterId int `json:"report_chapter_id"`
  23. ReportId int `json:"report_id"`
  24. Title string `json:"title"`
  25. TypeId int `json:"type_id"`
  26. TypeName string `json:"type_name"`
  27. Trend string `json:"trend"`
  28. ReportChapterTypeKey string `json:"report_chapter_type_key"`
  29. ReportChapterTypeThumb string `json:"report_chapter_type_thumb"`
  30. ReportChapterTypeName string `json:"report_chapter_type_name"`
  31. Sort int `json:"sort"`
  32. PublishTime time.Time `json:"publish_time"`
  33. IsClose int `gorm:"column:is_close;type:tinyint(1);default:0" json:"is_close"` //音频品种是否关闭
  34. Content string `description:"内容" json:"content"`
  35. VideoUrl string `json:"video_url" description:"音频文件URL"`
  36. VideoName string `json:"video_name" description:"音频文件名称"`
  37. VideoPlaySeconds string `json:"video_play_seconds" description:"音频播放时长"`
  38. VideoSize string `json:"video_size" description:"音频文件大小,单位M"`
  39. }
  40. type ReportItem struct {
  41. ReportId int `json:"report_id"`
  42. ClassifyNameFirst string `description:"一级分类名称" json:"classify_name_first"`
  43. ClassifyNameSecond string `description:"二级分类名称" json:"classify_name_second"`
  44. Title string `description:"标题" json:"title"`
  45. Abstract string `description:"摘要" json:"abstract"`
  46. Author string `description:"作者" json:"author"`
  47. Frequency string `description:"频度" json:"frequency"`
  48. PublishTime time.Time `description:"发布时间" json:"publish_time"`
  49. Stage int `description:"期数" json:"stage"`
  50. Content string `description:"内容" json:"content"`
  51. VideoUrl string `description:"音频文件URL" json:"video_url"`
  52. VideoName string `description:"音频文件名称" json:"video_name"`
  53. VideoSize string `description:"音频文件大小,单位M" json:"video_size"`
  54. VideoPlaySeconds string `description:"音频播放时长" json:"video_play_seconds"`
  55. VideoImg string `description:"音频播放条的图片" json:"video_img"`
  56. ContentSub string `description:"内容前两个章节" json:"content_sub"`
  57. BannerUrl string `description:"详情页banner" json:"banner_url"`
  58. ShareBgImg string `description:"分享背景图" json:"share_bg_img"`
  59. HasChapter int `description:"是否有章节" json:"has_chapter"`
  60. ReportLayout int8 `description:"报告布局,1:常规布局,2:智能布局。默认:1" json:"report_layout"`
  61. HeadImg string `description:"报告头图地址" json:"head_img"`
  62. EndImg string `description:"报告尾图地址" json:"end_img"`
  63. CanvasColor string `description:"画布颜色" json:"canvas_color"`
  64. HeadStyle string `description:"版头样式" json:"head_style"`
  65. EndStyle string `description:"版尾样式" json:"end_style"`
  66. ArticleId int `description:"文章ID"`
  67. Disclaimer string `description:"免责声明" json:"disclaimer"`
  68. }
  69. type Report struct {
  70. Id int `orm:"column(id)" description:"报告Id"`
  71. AddType int `json:"-" description:"新增方式:1:新增报告,2:继承报告"`
  72. ClassifyIdFirst int `description:"一级分类id"`
  73. ClassifyNameFirst string `description:"一级分类名称"`
  74. ClassifyIdSecond int `description:"二级分类id"`
  75. ClassifyNameSecond string `description:"二级分类名称"`
  76. Title string `description:"标题"`
  77. Abstract string `description:"摘要"`
  78. Author string `description:"作者"`
  79. Frequency string `description:"频度"`
  80. State int `description:"状态:1-未提交 2-待审核 3-驳回 4-审核"`
  81. Stage int `description:"期数"`
  82. MsgIsSend int `json:"-" description:"消息是否已发送,0:否,1:是"`
  83. ThsMsgIsSend int `json:"-" description:"客户群消息是否已发送,0:否,1:是"`
  84. Content string `description:"内容"`
  85. VideoUrl string `description:"音频文件URL"`
  86. VideoName string `description:"音频文件名称"`
  87. VideoPlaySeconds string `description:"音频播放时长"`
  88. VideoSize string `description:"音频文件大小,单位M"`
  89. ContentSub string `json:"-" description:"内容前两个章节"`
  90. ReportCode string `description:"报告唯一编码"`
  91. ReportVersion int `json:"-" description:"1:旧版,2:新版"`
  92. HasChapter int `json:"-" description:"是否有章节 0-否 1-是"`
  93. ChapterType string `json:"-" description:"章节类型 day-晨报 week-周报"`
  94. OldReportId int `json:"-" description:"research_report表ID, 大于0则表示该报告为老后台同步过来的"`
  95. MsgSendTime time.Time `json:"-" description:"模版消息发送时间"`
  96. AdminId int `description:"创建者账号"`
  97. AdminRealName string `description:"创建者姓名"`
  98. ApproveTime time.Time `description:"审批时间"`
  99. PublishTime time.Time `description:"发布时间"`
  100. CreateTime time.Time `description:"创建时间"`
  101. ModifyTime time.Time `description:"修改时间"`
  102. // eta1.8.3(研报改版)相关内容
  103. ContentStruct string `description:"内容组件"`
  104. LastModifyAdminId int `description:"最后更新人ID"`
  105. LastModifyAdminName string `description:"最后更新人姓名"`
  106. ContentModifyTime time.Time `description:"内容更新时间"`
  107. Pv int `description:"pv"`
  108. Uv int `description:"uv"`
  109. HeadImg string `description:"报告头图地址"`
  110. EndImg string `description:"报告尾图地址"`
  111. HeadStyle string `description:"版头样式"`
  112. EndStyle string `description:"版尾样式"`
  113. CanvasColor string `description:"画布颜色"`
  114. NeedSplice int `description:"是否拼接版头版位的标记,主要是为了兼容历史报告。0-不需要 1-需要"`
  115. HeadResourceId int `description:"版头资源ID"`
  116. EndResourceId int `description:"版尾资源ID"`
  117. ClassifyIdThird int `description:"三级分类id"`
  118. ClassifyNameThird string `description:"三级分类名称"`
  119. CollaborateType int8 `description:"协作方式,1:个人,2:多人协作。默认:1"`
  120. ReportLayout int8 `description:"报告布局,1:常规布局,2:智能布局。默认:1"`
  121. IsPublicPublish int8 `description:"是否公开发布,1:是,2:否"`
  122. ReportCreateTime time.Time `description:"报告时间创建时间"`
  123. }
  124. func GetByReportId(reportId int) (item *Report, err error) {
  125. o := orm.NewOrmUsingDB("rddp")
  126. sql := `SELECT * FROM report WHERE id =?`
  127. err = o.Raw(sql, reportId).QueryRow(&item)
  128. return
  129. }
  130. func GetFiccRreportToCygxArticle(condition string, pars []interface{}) (items []*Report, err error) {
  131. o := orm.NewOrmUsingDB("rddp")
  132. sql := ` SELECT * FROM report WHERE state = 2
  133. AND classify_name_first IN ('宏观报告','晨会纪要','调研纪要')
  134. AND classify_name_second IN ('大类资产周报','晨会纪要','黑色调研')
  135. AND IF ( classify_name_first = '宏观报告' , classify_name_second = '大类资产周报' ,1=1 )
  136. AND IF ( classify_name_first = '晨会纪要' , classify_name_second = '晨会纪要' ,1=1 )
  137. AND IF ( classify_name_first = '调研纪要' , classify_name_second = '黑色调研' ,1=1 ) ` + condition + ` ORDER BY modify_time DESC `
  138. _, err = o.Raw(sql, pars).QueryRows(&items)
  139. return
  140. }