purchase.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package purchase
  2. import (
  3. "hongze/hongze_yb/models/response"
  4. "time"
  5. )
  6. type PurchaseListItem struct {
  7. item
  8. Unread int `description:"未读数" json:"unread"`
  9. }
  10. type DetailResp struct {
  11. List []*Detail `json:"list"`
  12. Paging *response.PagingItem `json:"paging"`
  13. }
  14. type Detail struct {
  15. item
  16. TopName string `description:"主标题" json:"top_name"`
  17. }
  18. type item struct {
  19. ReportId int `description:"报告Id" json:"report_id"`
  20. ActivityId int `description:"活动ID" json:"activity_id"`
  21. ClassifyIdFirst int `description:"一级分类id" json:"classify_id_first"`
  22. ClassifyNameFirst string `description:"一级分类名称" json:"classify_name_first"`
  23. ClassifyIdSecond int `description:"二级分类id" json:"classify_id_second"`
  24. ClassifyNameSecond string `description:"二级分类名称" json:"classify_name_second"`
  25. Title string `description:"标题" json:"title"`
  26. Content string `description:"简介" json:"content"`
  27. Stage int `description:"期数" json:"stage"`
  28. Time time.Time `description:"更新时间" json:"time"`
  29. ImgUrl string `description:"背景图地址" json:"img_url"`
  30. }
  31. type PurchaseList []*PurchaseListItem
  32. func (p PurchaseList) Len() int {
  33. return len(p)
  34. }
  35. func (p PurchaseList) Less(i, j int) bool {
  36. if p[i].Time.Before(p[j].Time) {
  37. return false
  38. }
  39. return true
  40. }
  41. func (p PurchaseList) Swap(i, j int) {
  42. p[i], p[j] = p[j], p[i]
  43. }