user.go 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. package model
  2. import "go-common/library/time"
  3. // UserBase user base.
  4. type UserBase struct {
  5. Mid int64 `json:"mid"`
  6. UserID string `json:"userid"`
  7. Pwd []byte `json:"pwd"`
  8. Salt string `json:"salt"`
  9. Status int32 `json:"status"`
  10. Deleted int8 `json:"deleted"`
  11. CTime time.Time `json:"ctime"`
  12. MTime time.Time `json:"mtime"`
  13. }
  14. // UserEmail user email.
  15. type UserEmail struct {
  16. Mid int64 `json:"mid"`
  17. Email []byte `json:"email"`
  18. Verified int32 `json:"verified"`
  19. EmailBindTime int64 `json:"email_bind_time"`
  20. CTime time.Time `json:"ctime"`
  21. MTime time.Time `json:"mtime"`
  22. }
  23. // UserTel user tel.
  24. type UserTel struct {
  25. Mid int64 `json:"mid"`
  26. Tel []byte `json:"tel"`
  27. Cid string `json:"cid"`
  28. TelBindTime int64 `json:"tel_bind_time"`
  29. CTime time.Time `json:"ctime"`
  30. MTime time.Time `json:"mtime"`
  31. }
  32. // UserRegOrigin user reg origin.
  33. type UserRegOrigin struct {
  34. Mid int64 `json:"mid"`
  35. JoinIP int64 `json:"join_ip"`
  36. JoinIPV6 []byte `json:"join_ip_v6"`
  37. Port int32 `json:"port"`
  38. JoinTime int64 `json:"join_time"`
  39. Origin int32 `json:"origin"`
  40. RegType int32 `json:"reg_type"`
  41. AppID int64 `json:"appid"`
  42. CTime time.Time `json:"ctime"`
  43. MTime time.Time `json:"mtime"`
  44. }
  45. // UserSafeQuestion user safe question.
  46. type UserSafeQuestion struct {
  47. Mid int64 `json:"mid"`
  48. SafeQuestion int32 `json:"safe_question"`
  49. SafeAnswer []byte `json:"safe_answer"`
  50. SafeBindTime int64 `json:"safe_bind_time"`
  51. CTime time.Time `json:"ctime"`
  52. MTime time.Time `json:"mtime"`
  53. }
  54. // UserThirdBind user third bind.
  55. type UserThirdBind struct {
  56. ID int64 `json:"id"`
  57. Mid int64 `json:"mid"`
  58. OpenID string `json:"openid"`
  59. PlatForm int64 `json:"platform"`
  60. Token string `json:"token"`
  61. Expires int64 `json:"expires"`
  62. CTime time.Time `json:"ctime"`
  63. MTime time.Time `json:"mtime"`
  64. }
  65. // UserTelDuplicate user tel duplicate.
  66. type UserTelDuplicate struct {
  67. ID int64 `json:"id"`
  68. Mid int64 `json:"mid"`
  69. Tel []byte `json:"tel"`
  70. Cid string `json:"cid"`
  71. TelBindTime int64 `json:"tel_bind_time"`
  72. Status int8 `json:"status"`
  73. Timestamp int64 `json:"ts"`
  74. }
  75. // UserEmailDuplicate user email duplicate.
  76. type UserEmailDuplicate struct {
  77. ID int64 `json:"id"`
  78. Mid int64 `json:"mid"`
  79. Email []byte `json:"email"`
  80. Verified int32 `json:"verified"`
  81. EmailBindTime int64 `json:"email_bind_time"`
  82. Status int8 `json:"status"`
  83. Timestamp int64 `json:"ts"`
  84. }
  85. // ConvertToProto convert to proto
  86. func (u *UserBase) ConvertToProto() *UserBaseProto {
  87. return &UserBaseProto{
  88. Mid: u.Mid,
  89. UserID: u.UserID,
  90. Pwd: u.Pwd,
  91. Salt: u.Salt,
  92. Status: u.Status,
  93. }
  94. }
  95. // ConvertToProto convert to proto
  96. func (u *UserTel) ConvertToProto() *UserTelProto {
  97. return &UserTelProto{
  98. Mid: u.Mid,
  99. Tel: u.Tel,
  100. Cid: u.Cid,
  101. TelBindTime: u.TelBindTime,
  102. }
  103. }
  104. // ConvertToProto convert to proto
  105. func (u *UserEmail) ConvertToProto() *UserEmailProto {
  106. return &UserEmailProto{
  107. Mid: u.Mid,
  108. Email: u.Email,
  109. Verified: u.Verified,
  110. EmailBindTime: u.EmailBindTime,
  111. }
  112. }
  113. // ConvertToProto convert to proto
  114. func (u *UserRegOrigin) ConvertToProto() *UserRegOriginProto {
  115. return &UserRegOriginProto{
  116. Mid: u.Mid,
  117. JoinIP: u.JoinIP,
  118. JoinIPV6: u.JoinIPV6,
  119. Port: u.Port,
  120. JoinTime: u.JoinTime,
  121. Origin: u.Origin,
  122. RegType: u.RegType,
  123. AppID: u.AppID,
  124. }
  125. }
  126. // ConvertToProto convert to proto
  127. func (u *UserThirdBind) ConvertToProto() *UserThirdBindProto {
  128. return &UserThirdBindProto{
  129. ID: u.ID,
  130. Mid: u.Mid,
  131. OpenID: u.OpenID,
  132. PlatForm: u.PlatForm,
  133. Token: u.Token,
  134. Expires: u.Expires,
  135. }
  136. }
  137. // ConvertToProto convert to proto
  138. func (u *UserSafeQuestion) ConvertToProto() *UserSafeQuestionProto {
  139. return &UserSafeQuestionProto{
  140. Mid: u.Mid,
  141. SafeQuestion: u.SafeQuestion,
  142. SafeAnswer: u.SafeAnswer,
  143. SafeBindTime: u.SafeBindTime,
  144. }
  145. }