report.go 6.1 KB

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