report.go 6.1 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. 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. HeadResourceId int `description:"版头资源库id"`
  40. EndResourceId int `description:"版尾资源库id"`
  41. HeadResourceUrl string `description:"版头资源库Url"`
  42. EndResourceUrl string `description:"版尾资源库Url"`
  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. Title string `description:"标题"`
  53. Abstract string `description:"摘要"`
  54. Author string `description:"作者"`
  55. Frequency string `description:"频度"`
  56. CreateTime string `description:"创建时间"`
  57. ModifyTime string `description:"修改时间"`
  58. State int `description:"1:未发布,2:已发布"`
  59. PublishTime string `description:"发布时间"`
  60. Stage int `description:"期数"`
  61. MsgIsSend int `description:"消息是否已发送,0:否,1:是"`
  62. Content string `description:"内容"`
  63. ChapterContent []*ReportChapter `description:"章节内容"`
  64. VideoUrl string `description:"音频文件URL"`
  65. VideoName string `description:"音频文件名称"`
  66. VideoPlaySeconds string `description:"音频播放时长"`
  67. VideoSize string `description:"音频文件大小,单位M"`
  68. ContentSub string `description:"内容前两个章节"`
  69. IsShowNewLabel int `description:"是否显示新标签"`
  70. IsCurrentDate int `description:"是否当前日期"`
  71. ClassifyName string `description:"分类名称"`
  72. TitleType string `description:"标题类型,FICC或者权益"`
  73. IsPublic bool `description:"是否是公共报告"`
  74. CollaborateType int `description:"合作类型, 1:个人,2:多人协作"`
  75. ReportLayout int `description:"报告布局, 1:常规布局,2:智能布局"`
  76. HasChapter int `description:"是否有章节: 0-否 1-是"`
  77. HeadResourceId int `description:"版头资源库id"`
  78. EndResourceId int `description:"版尾资源库id"`
  79. HeadResourceUrl string `description:"版头资源库Url"`
  80. EndResourceUrl string `description:"版尾资源库Url"`
  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] }