app.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. package model
  2. import (
  3. accwar "go-common/app/service/main/account/api"
  4. "go-common/app/service/main/account/model"
  5. )
  6. // AppAccInfo app acc info struct.
  7. type AppAccInfo struct {
  8. Mid int64 `json:"mid"`
  9. Name string `json:"name"`
  10. Sex string `json:"sex"`
  11. Face string `json:"face"`
  12. Sign string `json:"sign"`
  13. Rank int32 `json:"rank"`
  14. Level int32 `json:"level"`
  15. LevelInfo accwar.LevelInfo `json:"level_info"`
  16. Pendant model.PendantInfo `json:"pendant"`
  17. Silence int32 `json:"silence"`
  18. Vip struct {
  19. Type int32 `json:"vipType"`
  20. VipStatus int32 `json:"vipStatus"`
  21. } `json:"vip"`
  22. OfficialInfo struct {
  23. Type int `json:"type"`
  24. Desc string `json:"desc"`
  25. } `json:"official_info"`
  26. Following int64 `json:"following"`
  27. Follower int64 `json:"follower"`
  28. Relation interface{} `json:"relation"`
  29. BeRelation interface{} `json:"be_relation"`
  30. FansGroup int `json:"fans_group"`
  31. Audio int `json:"audio"`
  32. Shop interface{} `json:"shop"`
  33. Elec interface{} `json:"elec"`
  34. Live interface{} `json:"live"`
  35. FansBadge bool `json:"fans_badge"`
  36. TopPhoto string `json:"top_photo"`
  37. Block *AccBlock `json:"block,omitempty"`
  38. }
  39. // FromProfile from account profile.
  40. func (ai *AppAccInfo) FromProfile(p *accwar.ProfileStatReply) {
  41. ai.Mid = p.Profile.Mid
  42. ai.Name = p.Profile.Name
  43. ai.Sex = p.Profile.Sex
  44. ai.Face = p.Profile.Face
  45. ai.Sign = p.Profile.Sign
  46. ai.Rank = p.Profile.Rank
  47. ai.Face = p.Profile.Face
  48. ai.Level = p.Profile.Level
  49. ai.Silence = p.Profile.Silence
  50. ai.Vip.Type = p.Profile.Vip.Type
  51. ai.Vip.VipStatus = p.Profile.Vip.Status
  52. ai.Pendant = p.Profile.Pendant
  53. if p.Profile.Official.Role == 0 {
  54. ai.OfficialInfo.Type = -1
  55. } else {
  56. if p.Profile.Official.Role <= 2 {
  57. ai.OfficialInfo.Type = 0
  58. ai.OfficialInfo.Desc = p.Profile.Official.Title
  59. } else {
  60. ai.OfficialInfo.Type = 1
  61. ai.OfficialInfo.Desc = p.Profile.Official.Title
  62. }
  63. }
  64. ai.Following = p.Following
  65. ai.Follower = p.Follower
  66. }
  67. // AppTab tab if show.
  68. type AppTab struct {
  69. Dynamic bool `json:"dynamic"`
  70. Shop bool `json:"shop"`
  71. Archive bool `json:"video"`
  72. Article bool `json:"article"`
  73. Audio bool `json:"audio"`
  74. Album bool `json:"album"`
  75. Favorite bool `json:"favorite"`
  76. Bangumi bool `json:"bangumi"`
  77. Game bool `json:"game"`
  78. }
  79. // AppIndex app index data.
  80. type AppIndex struct {
  81. Info *AppAccInfo `json:"info"`
  82. Tab *AppTab `json:"tab"`
  83. Dynamic *DyTotal `json:"dynamic"`
  84. Archive *UpArc `json:"archive"`
  85. }
  86. // AppIndexArg .
  87. type AppIndexArg struct {
  88. Mid int64
  89. Vmid int64 `form:"mid" validate:"min=1"`
  90. Qn int `form:"qn" default:"16" validate:"min=1"`
  91. Platform string `form:"platform" default:"android"`
  92. Ps int32 `form:"ps" default:"16" validate:"min=1"`
  93. Device string `form:"device"`
  94. }