account.go 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. package model
  2. import (
  3. "strconv"
  4. accmdl "go-common/app/service/main/account/api"
  5. account "go-common/app/service/main/account/model"
  6. )
  7. // Space space top photo
  8. type Space struct {
  9. SImg string `json:"s_img"`
  10. LImg string `json:"l_img"`
  11. }
  12. // Card Card and Space and Relation and Archive Count.
  13. type Card struct {
  14. Card *AccountCard `json:"card"`
  15. Space *Space `json:"space,omitempty"`
  16. Following bool `json:"following"`
  17. ArchiveCount int `json:"archive_count"`
  18. ArticleCount int `json:"article_count"`
  19. Follower int64 `json:"follower"`
  20. }
  21. // AccountCard struct.
  22. type AccountCard struct {
  23. Mid string `json:"mid"`
  24. Name string `json:"name"`
  25. Approve bool `json:"approve"`
  26. Sex string `json:"sex"`
  27. Rank string `json:"rank"`
  28. Face string `json:"face"`
  29. DisplayRank string `json:"DisplayRank"`
  30. Regtime int64 `json:"regtime"`
  31. Spacesta int `json:"spacesta"`
  32. Birthday string `json:"birthday"`
  33. Place string `json:"place"`
  34. Description string `json:"description"`
  35. Article int `json:"article"`
  36. Attentions []int64 `json:"attentions"`
  37. Fans int `json:"fans"`
  38. Friend int `json:"friend"`
  39. Attention int `json:"attention"`
  40. Sign string `json:"sign"`
  41. LevelInfo struct {
  42. Cur int `json:"current_level"`
  43. Min int `json:"current_min"`
  44. NowExp int `json:"current_exp"`
  45. NextExp interface{} `json:"next_exp"`
  46. } `json:"level_info"`
  47. Pendant account.PendantInfo `json:"pendant"`
  48. Nameplate account.NameplateInfo `json:"nameplate"`
  49. Official accmdl.OfficialInfo
  50. OfficialVerify struct {
  51. Type int `json:"type"`
  52. Desc string `json:"desc"`
  53. } `json:"official_verify"`
  54. Vip struct {
  55. Type int `json:"vipType"`
  56. DueRemark string `json:"dueRemark"`
  57. AccessStatus int `json:"accessStatus"`
  58. VipStatus int `json:"vipStatus"`
  59. VipStatusWarn string `json:"vipStatusWarn"`
  60. } `json:"vip"`
  61. }
  62. // FromCard from account catd.
  63. func (ac *AccountCard) FromCard(c *account.Card) {
  64. ac.Mid = strconv.FormatInt(c.Mid, 10)
  65. ac.Name = c.Name
  66. // ac.Approve =
  67. ac.Sex = c.Sex
  68. ac.Rank = strconv.FormatInt(int64(c.Rank), 10)
  69. ac.DisplayRank = "0"
  70. ac.Face = c.Face
  71. // ac.Regtime =
  72. if c.Silence == 1 {
  73. ac.Spacesta = -2
  74. }
  75. // ac.Birthday =
  76. // ac.Place =
  77. // ac.Description =
  78. // ac.Article =
  79. // ac.Attentions = []int64{}
  80. // ac.Fans =
  81. // ac.Friend
  82. // ac.Attention =
  83. ac.Sign = c.Sign
  84. ac.LevelInfo.Cur = int(c.Level)
  85. ac.LevelInfo.NextExp = 0
  86. // ac.LevelInfo.Min =
  87. ac.Pendant = c.Pendant
  88. ac.Nameplate = c.Nameplate
  89. if c.Official.Role == 0 {
  90. ac.OfficialVerify.Type = -1
  91. } else {
  92. if c.Official.Role <= 2 {
  93. ac.OfficialVerify.Type = 0
  94. ac.OfficialVerify.Desc = c.Official.Title
  95. } else {
  96. ac.OfficialVerify.Type = 1
  97. ac.OfficialVerify.Desc = c.Official.Title
  98. }
  99. }
  100. ac.Official = c.Official
  101. ac.Vip.Type = int(c.Vip.Type)
  102. ac.Vip.VipStatus = int(c.Vip.Status)
  103. }
  104. // DefaultProfile .
  105. var DefaultProfile = &accmdl.ProfileStatReply{
  106. Profile: &account.Profile{
  107. Sex: "保密",
  108. Rank: 10000,
  109. Face: "https://static.hdslb.com/images/member/noface.gif",
  110. Sign: "没签名",
  111. },
  112. LevelInfo: accmdl.LevelInfo{},
  113. }