report.go 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type Report struct {
  7. Id int `description:"报告Id"`
  8. AddType int `description:"新增方式:1:新增报告,2:继承报告"`
  9. ClassifyIdFirst int `description:"一级分类id"`
  10. ClassifyNameFirst string `description:"一级分类名称"`
  11. ClassifyIdSecond int `description:"二级分类id"`
  12. ClassifyNameSecond string `description:"二级分类名称"`
  13. Title string `description:"标题"`
  14. Abstract string `description:"摘要"`
  15. Author string `description:"作者"`
  16. Frequency string `description:"频度"`
  17. CreateTime string `description:"创建时间"`
  18. ModifyTime string `description:"修改时间"`
  19. State int `description:"1:未发布,2:已发布"`
  20. PublishTime string `description:"发布时间"`
  21. PrePublishTime string `description:"预发布时间"`
  22. Stage int `description:"期数"`
  23. MsgIsSend int `description:"消息是否已发送,0:否,1:是"`
  24. Content string `description:"内容"`
  25. VideoUrl string `description:"音频文件URL"`
  26. VideoName string `description:"音频文件名称"`
  27. VideoPlaySeconds string `description:"音频播放时长"`
  28. VideoSize string `description:"音频文件大小,单位M"`
  29. ContentSub string `description:"内容前两个章节"`
  30. IsShowNewLabel int `description:"是否显示新标签"`
  31. IsCurrentDate int `description:"是否当前日期"`
  32. ClassifyName string `description:"分类名称"`
  33. HasChapter int `description:"是否有章节"`
  34. // eta1.8.3(研报改版)相关内容
  35. ContentStruct string `description:"内容组件"`
  36. LastModifyAdminId int `description:"最后更新人ID"`
  37. LastModifyAdminName string `description:"最后更新人姓名"`
  38. ContentModifyTime time.Time `description:"内容更新时间"`
  39. Pv int `description:"pv"`
  40. Uv int `description:"uv"`
  41. HeadImg string `description:"报告头图地址"`
  42. EndImg string `description:"报告尾图地址"`
  43. HeadStyle string `description:"版头样式"`
  44. EndStyle string `description:"版尾样式"`
  45. CanvasColor string `description:"画布颜色"`
  46. NeedSplice int `description:"是否拼接版头版位的标记,主要是为了兼容历史报告。0-不需要 1-需要"`
  47. HeadResourceId int `description:"版头资源ID"`
  48. EndResourceId int `description:"版尾资源ID"`
  49. ClassifyIdThird int `description:"三级分类id"`
  50. ClassifyNameThird string `description:"三级分类名称"`
  51. CollaborateType int8 `description:"协作方式,1:个人,2:多人协作。默认:1"`
  52. ReportLayout int8 `description:"报告布局,1:常规布局,2:智能布局。默认:1"`
  53. IsPublicPublish int8 `description:"是否公开发布,1:是,2:否"`
  54. ReportCreateTime time.Time `description:"报告时间创建时间"`
  55. }
  56. func GetReportByCode(reportCode string) (item *Report, err error) {
  57. o := orm.NewOrm()
  58. sql := `SELECT * FROM report WHERE report_code=?`
  59. err = o.Raw(sql, reportCode).QueryRow(&item)
  60. return
  61. }
  62. type ReportShareDetailResp struct {
  63. Report *ReportItem `description:"报告"`
  64. Disclaimer string `description:"免责声明"`
  65. H5ShareName string `description:"研报分享抬头"`
  66. H5ReportShareImg string `description:"研报分享图片"`
  67. WatermarkChart string `description:"图表是否需要水印"`
  68. WatermarkReport string `description:"报告是否需要水印"`
  69. Hz int
  70. ReportLogo string `description:"报告logo"`
  71. }
  72. type ReportItem struct {
  73. *Report
  74. ChapterList []*ReportChapter
  75. }
  76. // UpdateReportPv
  77. // @Description: 研报pv自增
  78. // @author: Roc
  79. // @datetime 2024-07-19 15:46:58
  80. // @param reportId int
  81. // @return err error
  82. func UpdateReportPv(reportId int) (err error) {
  83. o := orm.NewOrm()
  84. sql := `UPDATE report SET pv = pv + 1 WHERE id = ?`
  85. _, err = o.Raw(sql, reportId).Exec()
  86. return
  87. }