loadpage.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. package model
  2. import (
  3. "go-common/library/time"
  4. )
  5. const (
  6. _TypeUGC = 2
  7. _TypePGC = 1
  8. )
  9. // Homepage is the home page struct
  10. type Homepage struct {
  11. Recom []*Card `json:"recom"`
  12. Latest []*Card `json:"latest"`
  13. Lists map[string][]*Card `json:"lists"`
  14. Follow []*Follow `json:"follow,omitempty"`
  15. }
  16. // Card is the unit to display
  17. type Card struct {
  18. SeasonID int `json:"season_id"`
  19. Title string `json:"title"`
  20. Cover string `json:"cover"`
  21. Type int `json:"type"` // 1=pgc, 2=ugc
  22. NewEP *NewEP `json:"new_ep"`
  23. CornerMark *SnVipCorner `json:"cornermark"`
  24. }
  25. // IsUGC returns whether the card is ugc card
  26. func (c Card) IsUGC() bool {
  27. return c.Type == _TypeUGC
  28. }
  29. // BePGC def.
  30. func (c *Card) BePGC() {
  31. c.Type = _TypePGC
  32. }
  33. // NewEP is the latest EP of a season
  34. type NewEP struct {
  35. ID int64 `json:"id"`
  36. Index string `json:"index"`
  37. IndexShow string `json:"index_show"`
  38. Cover string `json:"cover"`
  39. }
  40. // Rank represents the table TV_RANK
  41. type Rank struct {
  42. ID int64
  43. Rank int
  44. Title string
  45. Type int8
  46. CID int64
  47. ContID int64
  48. Category int8
  49. Position int32
  50. IsDeleted int8
  51. Ctime time.Time
  52. Mtime time.Time
  53. }
  54. // SimpleRank picks the necessary fields from tv_rank
  55. type SimpleRank struct {
  56. ContID int64
  57. ContType int
  58. }
  59. // RespModInterv is the response struct for mod intervention
  60. type RespModInterv struct {
  61. Ranks []*SimpleRank
  62. AIDs []int64
  63. SIDs []int64
  64. }
  65. // IsUGC returns whether the card is ugc card
  66. func (c SimpleRank) IsUGC() bool {
  67. return c.ContType == _TypeUGC
  68. }
  69. // ReqZone is the request struct of zone page
  70. type ReqZone struct {
  71. SType int
  72. IntervType int
  73. LengthLimit int
  74. IntervM int
  75. PGCListM map[int][]*Card
  76. }
  77. //RespAI is the response of AI ugc rank data
  78. type RespAI struct {
  79. Note string `json:"note"`
  80. SourceData string `json:"source_data"`
  81. Code int `json:"code"`
  82. Num int `json:"num"`
  83. List []*AIData `json:"list"`
  84. }
  85. // AIData is the ai card structure
  86. type AIData struct {
  87. AID int `json:"aid"`
  88. MID int `json:"mid"`
  89. Pts int `json:"pts"`
  90. Play int `json:"play"`
  91. Coints int `json:"coins"`
  92. VideoReview int `json:"video_review"`
  93. }
  94. //ToCard transforms an ArcCMS to Card
  95. func (a ArcCMS) ToCard() *Card {
  96. return &Card{
  97. SeasonID: int(a.AID),
  98. Title: a.Title,
  99. Cover: a.Cover,
  100. Type: _TypeUGC,
  101. NewEP: &NewEP{Cover: a.Cover},
  102. }
  103. }
  104. //ToIdxSn transforms an ArcCMS to IdxSeason
  105. func (a ArcCMS) ToIdxSn() *IdxSeason {
  106. return &IdxSeason{
  107. SeasonID: a.AID,
  108. Title: a.Title,
  109. Cover: a.Cover,
  110. Upinfo: "",
  111. }
  112. }
  113. // ReqZoneInterv is the request structure for zone intervention
  114. type ReqZoneInterv struct {
  115. RankType int
  116. Category int
  117. Limit int
  118. }