report.go 5.3 KB

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