passport.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. package model
  2. import (
  3. xtime "go-common/library/time"
  4. "strings"
  5. )
  6. // PassportProfile is
  7. type PassportProfile struct {
  8. Mid int64 `json:"mid"`
  9. UName string `json:"uname"`
  10. UserID string `json:"user_id"`
  11. Telphone string `json:"telphone"`
  12. Email string `json:"email"`
  13. NickLock int `json:"nick_lock"`
  14. BindQQ bool `json:"bind_qq"`
  15. BindSina bool `json:"bind_sina"`
  16. SpaceSta int `json:"spacesta"`
  17. LoginTime xtime.Time `json:"login_time"`
  18. LoginIP string `json:"login_ip"`
  19. JoinIP string `json:"join_ip"`
  20. JoinTime xtime.Time `json:"join_time"`
  21. SafeQuestion int `json:"safe_question"`
  22. CountryCode int64 `json:"country_code"`
  23. }
  24. func bool2int(in bool) int64 {
  25. if in {
  26. return 1
  27. }
  28. return 0
  29. }
  30. // TelStatus is
  31. func (p *PassportProfile) TelStatus() int64 {
  32. return bool2int(p.Telphone != "")
  33. }
  34. // EmailSuffix is
  35. func (p *PassportProfile) EmailSuffix() string {
  36. if !strings.Contains(p.Email, "@") {
  37. return p.Email
  38. }
  39. parts := strings.SplitN(p.Email, "@", 2)
  40. return parts[1]
  41. }
  42. // AsoAccountRegOrigin is
  43. type AsoAccountRegOrigin struct {
  44. Mid int64 `json:"mid"`
  45. OriginType int64 `json:"origin_type"`
  46. RegType int64 `json:"reg_type"`
  47. }