acc.go 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. package model
  2. import (
  3. "strconv"
  4. v1 "go-common/app/service/main/account/api"
  5. mmodel "go-common/app/service/main/member/model"
  6. )
  7. // AccJavaInfo thin infomartion
  8. type AccJavaInfo struct {
  9. Mid int64 `json:"mid"`
  10. Scores int32 `json:"scores"`
  11. JoinTime int32 `json:"jointime"`
  12. Silence int32 `json:"silence"`
  13. EmailStatus int32 `json:"email_status"`
  14. TelStatus int32 `json:"tel_status"`
  15. Identification int32 `json:"identification"`
  16. Moral int32 `json:"moral"`
  17. Nameplate struct {
  18. Nid int `json:"nid"`
  19. Name string `json:"name"`
  20. Image string `json:"image"`
  21. ImageSmall string `json:"image_small"`
  22. Level string `json:"level"`
  23. Condition string `json:"condition"`
  24. } `json:"nameplate"`
  25. }
  26. // OldInfo old info.
  27. type OldInfo struct {
  28. Mid string `json:"mid"`
  29. Name string `json:"uname"`
  30. Sex string `json:"sex"`
  31. Sign string `json:"sign"`
  32. Avatar string `json:"avatar"`
  33. Rank string `json:"rank"`
  34. DisplayRank string `json:"DisplayRank"`
  35. LevelInfo mmodel.LevelInfo `json:"level_info"`
  36. Official OldOfficial `json:"official_verify"`
  37. Vip v1.VipInfo `json:"vip"`
  38. }
  39. // OldOfficial old official.
  40. type OldOfficial struct {
  41. Type int8 `json:"type"`
  42. Desc string `json:"desc"`
  43. }
  44. // CvtOfficial is used to convert to old official.
  45. func CvtOfficial(o v1.OfficialInfo) OldOfficial {
  46. old := OldOfficial{}
  47. if o.Role == 0 {
  48. old.Type = -1
  49. } else {
  50. if o.Role <= 2 {
  51. old.Type = 0
  52. } else {
  53. old.Type = 1
  54. }
  55. old.Desc = o.Title
  56. }
  57. return old
  58. }
  59. // Info old info -> info.
  60. func (oi *OldInfo) Info() *v1.Info {
  61. mid, _ := strconv.ParseInt(oi.Mid, 10, 64)
  62. rank, _ := strconv.ParseInt(oi.Rank, 10, 64)
  63. i := &v1.Info{
  64. Mid: mid,
  65. Name: oi.Name,
  66. Sex: oi.Sex,
  67. Face: oi.Avatar,
  68. Sign: oi.Sign,
  69. Rank: int32(rank),
  70. }
  71. return i
  72. }
  73. // Relation relation.
  74. type Relation struct {
  75. Following bool `json:"following"`
  76. }
  77. // ProfileStat profile with stat.
  78. type ProfileStat struct {
  79. *v1.Profile
  80. LevelExp mmodel.LevelInfo `json:"level_exp"`
  81. Coins float64 `json:"coins"`
  82. Following int64 `json:"following"`
  83. Follower int64 `json:"follower"`
  84. }
  85. // SearchMemberResult is.
  86. type SearchMemberResult struct {
  87. Order string `json:"order"`
  88. Sort string `json:"sort"`
  89. Result []struct {
  90. Mid int64 `json:"mid"`
  91. } `json:"result"`
  92. Page Page `json:"page"`
  93. }
  94. // Privacy .
  95. type Privacy struct {
  96. Realname string `json:"realname"`
  97. IdentityCard string `json:"identity_card"`
  98. IdentitySex string `json:"identity_sex"`
  99. Tel string `json:"tel"`
  100. RegIP string `json:"reg_ip"`
  101. RegTS int64 `json:"reg_ts"`
  102. HandIMG string `json:"hand_img"`
  103. }
  104. // Page page.
  105. type Page struct {
  106. Num int `json:"num"`
  107. Size int `json:"size"`
  108. Total int `json:"total"`
  109. }
  110. // Mids is.
  111. func (r *SearchMemberResult) Mids() []int64 {
  112. mids := make([]int64, 0, len(r.Result))
  113. for _, r := range r.Result {
  114. mids = append(mids, r.Mid)
  115. }
  116. return mids
  117. }