rank_game_info.dart 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. import 'package:sport/bean/user.dart';
  2. class RankGameInfoData {
  3. Rank rank;
  4. User user;
  5. List<User> records;
  6. RankGameInfoData({this.rank, this.user, this.records});
  7. RankGameInfoData.fromJson(Map<String, dynamic> json) {
  8. rank = json['rank'] != null ? new Rank.fromJson(json['rank']) : null;
  9. user = json['user'] != null ? new User.fromJson(json['user']) : null;
  10. if (json['records'] != null) {
  11. records = new List<User>();
  12. json['records'].forEach((v) {
  13. records.add(new User.fromJson(v));
  14. });
  15. }
  16. }
  17. Map<String, dynamic> toJson() {
  18. final Map<String, dynamic> data = new Map<String, dynamic>();
  19. if (this.rank != null) {
  20. data['rank'] = this.rank.toJson();
  21. }
  22. if (this.user != null) {
  23. data['user'] = this.user.toJson();
  24. }
  25. if (this.records != null) {
  26. data['records'] = this.records.map((v) => v.toJson()).toList();
  27. }
  28. return data;
  29. }
  30. }
  31. class Rank {
  32. int id;
  33. String name;
  34. int isGame;
  35. int isSport;
  36. int gameId;
  37. String introduce;
  38. String introduceDetail;
  39. String rule;
  40. String distribute;
  41. int userCountMax;
  42. String rateBegin;
  43. String rateEnd;
  44. String logo;
  45. String field;
  46. String slogan;
  47. List<RankReward> reward;
  48. Rank(
  49. {this.id,
  50. this.name,
  51. this.isGame,
  52. this.isSport,
  53. this.gameId,
  54. this.introduce,
  55. this.userCountMax,
  56. this.rateBegin,
  57. this.rateEnd,
  58. this.logo,
  59. this.field,
  60. this.slogan,
  61. this.reward,
  62. });
  63. Rank.fromJson(Map<String, dynamic> json) {
  64. id = json['id'];
  65. name = json['name'];
  66. isGame = json['is_game'];
  67. isSport = json['is_sport'];
  68. gameId = json['game_id'];
  69. introduce = json['introduce'];
  70. introduceDetail = json['introduce_detail'];
  71. rule = json['rule'];
  72. distribute = json['distribute'];
  73. userCountMax = json['user_count_max'];
  74. rateBegin = json['rate_begin'];
  75. rateEnd = json['rate_end'];
  76. logo = json['logo'];
  77. field = json['field'];
  78. slogan = json['slogan'];
  79. if (json['reward'] != null) {
  80. reward = new List<RankReward>();
  81. json['reward'].forEach((v) {
  82. reward.add(new RankReward.fromJson(v));
  83. });
  84. }
  85. }
  86. Map<String, dynamic> toJson() {
  87. final Map<String, dynamic> data = new Map<String, dynamic>();
  88. data['id'] = this.id;
  89. data['name'] = this.name;
  90. data['is_game'] = this.isGame;
  91. data['is_sport'] = this.isSport;
  92. data['game_id'] = this.gameId;
  93. data['introduce'] = this.introduce;
  94. data['introduce_detail'] = this.introduceDetail;
  95. data['distribute'] = this.distribute;
  96. data['rule'] = this.rule;
  97. data['user_count_max'] = this.userCountMax;
  98. data['rate_begin'] = this.rateBegin;
  99. data['rate_end'] = this.rateEnd;
  100. data['logo'] = this.logo;
  101. data['field'] = this.field;
  102. data['slogan'] = this.slogan;
  103. data['reward'] = this.reward;
  104. return data;
  105. }
  106. }
  107. class RankReward{
  108. int begin;
  109. int end;
  110. int score;
  111. RankReward({
  112. this.begin,
  113. this.end,
  114. this.score
  115. });
  116. Map<String, dynamic> toJson() {
  117. final Map<String, dynamic> data = new Map<String, dynamic>();
  118. data['begin'] = this.begin;
  119. data['end'] = this.end;
  120. data['score'] = this.score;
  121. return data;
  122. }
  123. RankReward.fromJson(Map<String, dynamic> json) {
  124. begin = json['begin'];
  125. end = json['end'];
  126. score = json['score'];
  127. }
  128. }