archive.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. package model
  2. import (
  3. v1 "go-common/app/service/main/archive/api"
  4. "go-common/library/time"
  5. )
  6. // UpArcStat up archives stat struct.
  7. type UpArcStat struct {
  8. View int64 `json:"view"`
  9. Reply int64 `json:"reply"`
  10. Dm int64 `json:"dm"`
  11. Fans int64 `json:"fans"`
  12. }
  13. // ArchiveReason archive with reason struct.
  14. type ArchiveReason struct {
  15. *v1.Arc
  16. Reason string `json:"reason"`
  17. }
  18. // SearchRes search res data.
  19. type SearchRes struct {
  20. TList map[string]*SearchTList `json:"tlist"`
  21. VList []*SearchVList `json:"vlist"`
  22. }
  23. // SearchTList search cate list.
  24. type SearchTList struct {
  25. Tid int64 `json:"tid"`
  26. Count int64 `json:"count"`
  27. Name string `json:"name"`
  28. }
  29. // SearchVList video list.
  30. type SearchVList struct {
  31. Comment int64 `json:"comment"`
  32. TypeID int64 `json:"typeid"`
  33. Play interface{} `json:"play"`
  34. Pic string `json:"pic"`
  35. SubTitle string `json:"subtitle"`
  36. Description string `json:"description"`
  37. Copyright string `json:"copyright"`
  38. Title string `json:"title"`
  39. Review int64 `json:"review"`
  40. Author string `json:"author"`
  41. Mid int64 `json:"mid"`
  42. Created string `json:"created"`
  43. Length string `json:"length"`
  44. VideoReview int64 `json:"video_review"`
  45. Aid int64 `json:"aid"`
  46. HideClick bool `json:"hide_click"`
  47. IsPay int `json:"is_pay"`
  48. IsUnionVideo int `json:"is_union_video"`
  49. }
  50. // UpArc up archive struct
  51. type UpArc struct {
  52. Count int64 `json:"count"`
  53. List []*ArcItem `json:"list"`
  54. }
  55. // ArcItem space archive item.
  56. type ArcItem struct {
  57. Aid int64 `json:"aid"`
  58. Pic string `json:"pic"`
  59. Title string `json:"title"`
  60. Duration int64 `json:"duration"`
  61. Author struct {
  62. Mid int64 `json:"mid"`
  63. Name string `json:"name"`
  64. Face string `json:"face"`
  65. } `json:"author"`
  66. Stat struct {
  67. View interface{} `json:"view"`
  68. Danmaku int32 `json:"danmaku"`
  69. Reply int32 `json:"reply"`
  70. Fav int32 `json:"favorite"`
  71. Coin int32 `json:"coin"`
  72. Share int32 `json:"share"`
  73. Like int32 `json:"like"`
  74. } `json:"stat"`
  75. Rights v1.Rights `json:"rights"`
  76. Pubdate time.Time `json:"pubdate"`
  77. }
  78. // FromArc from archive to space act item.
  79. func (ac *ArcItem) FromArc(arc *v1.Arc) {
  80. ac.Aid = arc.Aid
  81. ac.Pic = arc.Pic
  82. ac.Title = arc.Title
  83. ac.Duration = arc.Duration
  84. ac.Author.Mid = arc.Author.Mid
  85. ac.Author.Name = arc.Author.Name
  86. ac.Author.Face = arc.Author.Face
  87. ac.Stat.View = arc.Stat.View
  88. if arc.Access >= 10000 {
  89. ac.Stat.View = "--"
  90. }
  91. ac.Stat.Danmaku = arc.Stat.Danmaku
  92. ac.Stat.Reply = arc.Stat.Reply
  93. ac.Stat.Fav = arc.Stat.Fav
  94. ac.Stat.Share = arc.Stat.Share
  95. ac.Stat.Like = arc.Stat.Like
  96. ac.Pubdate = arc.PubDate
  97. ac.Rights = arc.Rights
  98. }