matchuser.go 834 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package matchbase
  2. type EnrollUser struct {
  3. UserId int
  4. EnrollTime int64
  5. }
  6. type MatchUser struct {
  7. UserId int
  8. NickName string
  9. FaceId int
  10. FaceUrl string
  11. Rank int
  12. Score int
  13. GameCount int
  14. BaseScore int
  15. WinCount int
  16. EnrollTime int64
  17. }
  18. type MatchUserBrief struct {
  19. UserId int
  20. NickName string
  21. Rank int
  22. Score int
  23. }
  24. func (mu *MatchUser) IsBetterThan(usr *MatchUser) bool {
  25. if mu.Score > usr.Score {
  26. return true
  27. } else if mu.Score < usr.Score {
  28. return false
  29. }
  30. if mu.WinCount > usr.WinCount {
  31. return true
  32. } else if mu.WinCount < usr.WinCount {
  33. return false
  34. }
  35. return mu.EnrollTime < usr.EnrollTime
  36. }
  37. func (mu *MatchUser) ToBrief() *MatchUserBrief {
  38. return &MatchUserBrief{
  39. UserId: mu.UserId,
  40. NickName: mu.NickName,
  41. Rank: mu.Rank,
  42. Score: mu.Score,
  43. }
  44. }