report.go 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. package models
  2. import (
  3. "eta/eta_mini_api/utils"
  4. "time"
  5. )
  6. type ReportView 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. ClassifyIdThird int `description:"三级分类id"`
  14. ClassifyNameThird string `description:"三级分类名称"`
  15. PermissionNames []string `description:"二级分类名称"`
  16. Title string `description:"标题"`
  17. Abstract string `description:"摘要"`
  18. Author string `description:"作者"`
  19. Frequency string `description:"频度"`
  20. CreateTime string `description:"创建时间"`
  21. ModifyTime time.Time `description:"修改时间"`
  22. State int `description:"1:未发布,2:已发布"`
  23. PublishTime string `description:"发布时间"`
  24. Stage int `description:"期数"`
  25. MsgIsSend int `description:"消息是否已发送,0:否,1:是"`
  26. Content string `description:"内容"`
  27. ChapterContent []*ReportChapter `description:"章节内容"`
  28. VideoUrl string `description:"音频文件URL"`
  29. VideoName string `description:"音频文件名称"`
  30. VideoPlaySeconds string `description:"音频播放时长"`
  31. VideoSize string `description:"音频文件大小,单位M"`
  32. HasPermission int `description:"是否拥有报告权限,1:拥有,0:没有"`
  33. TitleType string `description:"标题类型,FICC或者权益"`
  34. IsCurrentDate int `description:"是否当前日期:1是,0不是"`
  35. IsPublic bool `description:"是否是公共报告"`
  36. ReportType int `description:"报告类型,1:eta报告,2:pdf报告"`
  37. PdfUrl string `description:"pdf文件URL"`
  38. CollaborateType int `description:"合作类型, 1:个人,2:多人协作"`
  39. ReportLayout int `description:"报告布局, 1:常规布局,2:智能布局"`
  40. HasChapter int `description:"是否有章节: 0-否 1-是"`
  41. HeadResource *SmartReportResource `description:"版头资源库"`
  42. EndResource *SmartReportResource `description:"版尾资源库"`
  43. ClassifyDetail
  44. }
  45. type ReportDetail struct {
  46. Id int `description:"报告Id"`
  47. AddType int `description:"新增方式:1:新增报告,2:继承报告"`
  48. ClassifyIdFirst int `description:"一级分类id"`
  49. ClassifyNameFirst string `description:"一级分类名称"`
  50. ClassifyIdSecond int `description:"二级分类id"`
  51. ClassifyNameSecond string `description:"二级分类名称"`
  52. ClassifyIdThird int `description:"三级分类id"`
  53. ClassifyNameThird string `description:"三级分类名称"`
  54. Title string `description:"标题"`
  55. Abstract string `description:"摘要"`
  56. Author string `description:"作者"`
  57. Frequency string `description:"频度"`
  58. CreateTime string `description:"创建时间"`
  59. ModifyTime string `description:"修改时间"`
  60. State int `description:"1:未发布,2:已发布"`
  61. PublishTime string `description:"发布时间"`
  62. Stage int `description:"期数"`
  63. MsgIsSend int `description:"消息是否已发送,0:否,1:是"`
  64. Content string `description:"内容"`
  65. ChapterContent []*ReportChapter `description:"章节内容"`
  66. VideoUrl string `description:"音频文件URL"`
  67. VideoName string `description:"音频文件名称"`
  68. VideoPlaySeconds string `description:"音频播放时长"`
  69. VideoSize string `description:"音频文件大小,单位M"`
  70. ContentSub string `description:"内容前两个章节"`
  71. IsShowNewLabel int `description:"是否显示新标签"`
  72. IsCurrentDate int `description:"是否当前日期"`
  73. ClassifyName string `description:"分类名称"`
  74. TitleType string `description:"标题类型,FICC或者权益"`
  75. IsPublic bool `description:"是否是公共报告"`
  76. CollaborateType int `description:"合作类型, 1:个人,2:多人协作"`
  77. ReportLayout int `description:"报告布局, 1:常规布局,2:智能布局"`
  78. HasChapter int `description:"是否有章节: 0-否 1-是"`
  79. HeadResource SmartReportResource `description:"版头资源库"`
  80. EndResource SmartReportResource `description:"版尾资源库"`
  81. }
  82. type ReportChapter struct {
  83. Title string `description:"章节标题"`
  84. Content string `description:"章节内容"`
  85. }
  86. type SmartReportResource struct {
  87. ResourceId int `description:"资源库id"`
  88. ImgUrl string `description:"图片url"`
  89. Type int `description:"资源类型:1-版头 2-版尾"`
  90. Style string `description:"版图样式"`
  91. }
  92. type ByPublishTimeReportView []*ReportView
  93. func (a ByPublishTimeReportView) Len() int { return len(a) }
  94. func (a ByPublishTimeReportView) Less(i, j int) bool {
  95. if a[i].PublishTime == "" {
  96. return true
  97. }
  98. if a[j].PublishTime == "" {
  99. return false
  100. }
  101. aiTime, err := time.Parse(utils.FormatDateTime, a[i].PublishTime)
  102. if err != nil {
  103. return true
  104. }
  105. ajTime, err := time.Parse(utils.FormatDateTime, a[j].PublishTime)
  106. if err != nil {
  107. return false
  108. }
  109. return aiTime.After(ajTime)
  110. }
  111. func (a ByPublishTimeReportView) Swap(i, j int) { a[i], a[j] = a[j], a[i] }