report.go 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. VideoUrl string `description:"音频文件URL"`
  26. VideoName string `description:"音频文件名称"`
  27. VideoPlaySeconds string `description:"音频播放时长"`
  28. VideoSize string `description:"音频文件大小,单位M"`
  29. HasPermission int `description:"是否拥有报告权限,1:拥有,0:没有"`
  30. TitleType string `description:"标题类型,FICC或者权益"`
  31. IsCurrentDate int `description:"是否当前日期:1是,0不是"`
  32. IsPublic bool `description:"是否是公共报告"`
  33. ReportType int `description:"报告类型,1:eta报告,2:pdf报告"`
  34. PdfUrl string `description:"pdf文件URL"`
  35. ClassifyDetail
  36. }
  37. type ReportDetail struct {
  38. Id int `description:"报告Id"`
  39. AddType int `description:"新增方式:1:新增报告,2:继承报告"`
  40. ClassifyIdFirst int `description:"一级分类id"`
  41. ClassifyNameFirst string `description:"一级分类名称"`
  42. ClassifyIdSecond int `description:"二级分类id"`
  43. ClassifyNameSecond string `description:"二级分类名称"`
  44. Title string `description:"标题"`
  45. Abstract string `description:"摘要"`
  46. Author string `description:"作者"`
  47. Frequency string `description:"频度"`
  48. CreateTime string `description:"创建时间"`
  49. ModifyTime string `description:"修改时间"`
  50. State int `description:"1:未发布,2:已发布"`
  51. PublishTime string `description:"发布时间"`
  52. Stage int `description:"期数"`
  53. MsgIsSend int `description:"消息是否已发送,0:否,1:是"`
  54. Content string `description:"内容"`
  55. VideoUrl string `description:"音频文件URL"`
  56. VideoName string `description:"音频文件名称"`
  57. VideoPlaySeconds string `description:"音频播放时长"`
  58. VideoSize string `description:"音频文件大小,单位M"`
  59. ContentSub string `description:"内容前两个章节"`
  60. IsShowNewLabel int `description:"是否显示新标签"`
  61. IsCurrentDate int `description:"是否当前日期"`
  62. ClassifyName string `description:"分类名称"`
  63. TitleType string `description:"标题类型,FICC或者权益"`
  64. IsPublic bool `description:"是否是公共报告"`
  65. }
  66. type ByPublishTimeReportView []*ReportView
  67. func (a ByPublishTimeReportView) Len() int { return len(a) }
  68. func (a ByPublishTimeReportView) Less(i, j int) bool {
  69. if a[i].PublishTime == "" {
  70. return true
  71. }
  72. if a[j].PublishTime == "" {
  73. return false
  74. }
  75. aiTime, err := time.Parse(utils.FormatDateTime, a[i].PublishTime)
  76. if err != nil {
  77. return true
  78. }
  79. ajTime, err := time.Parse(utils.FormatDateTime, a[j].PublishTime)
  80. if err != nil {
  81. return false
  82. }
  83. return aiTime.After(ajTime)
  84. }
  85. func (a ByPublishTimeReportView) Swap(i, j int) { a[i], a[j] = a[j], a[i] }