shop.dart 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. class ShopIndex {
  2. Shop? shop;
  3. List<Items>? items;
  4. ShopUser? user;
  5. ShopIndex({this.shop, this.items, this.user});
  6. ShopIndex.fromJson(Map<String, dynamic> json) {
  7. print(json);
  8. shop = json['shop'] != null ? new Shop.fromJson(json['shop']) : null;
  9. if (json['items'] != null) {
  10. items =[];
  11. json['items'].forEach((v) {
  12. items!.add(new Items.fromJson(v));
  13. });
  14. }
  15. user = json['user'] != null ? new ShopUser.fromJson(json['user']) : null;
  16. }
  17. Map<String, dynamic> toJson() {
  18. final Map<String, dynamic> data = new Map<String, dynamic>();
  19. if (this.shop != null) {
  20. data['shop'] = this.shop!.toJson();
  21. }
  22. if (this.items != null) {
  23. data['items'] = this.items!.map((v) => v.toJson()).toList();
  24. }
  25. if (this.user != null) {
  26. data['user'] = this.user!.toJson();
  27. }
  28. return data;
  29. }
  30. }
  31. class Shop {
  32. int? id;
  33. int? gameId;
  34. String? name;
  35. String? type;
  36. Shop({this.id, this.gameId, this.name, this.type});
  37. Shop.fromJson(Map<String, dynamic> json) {
  38. id = json['id'];
  39. gameId = json['game_id'];
  40. name = json['name'];
  41. type = json['type'];
  42. }
  43. Map<String, dynamic> toJson() {
  44. final Map<String, dynamic> data = new Map<String, dynamic>();
  45. data['id'] = this.id;
  46. data['game_id'] = this.gameId;
  47. data['name'] = this.name;
  48. data['type'] = this.type;
  49. return data;
  50. }
  51. }
  52. class Items {
  53. int? id;
  54. int? shopId;
  55. int? gameId;
  56. String? name;
  57. String? logo;
  58. int? price;
  59. String? detail;
  60. int? valid;
  61. Items(
  62. {this.id,
  63. this.shopId,
  64. this.gameId,
  65. this.name,
  66. this.logo,
  67. this.price,
  68. this.detail,
  69. this.valid});
  70. Items.fromJson(Map<String, dynamic> json) {
  71. id = json['id'];
  72. shopId = json['shop_id'];
  73. gameId = json['game_id'];
  74. name = json['name'];
  75. logo = json['logo'];
  76. price = json['price'];
  77. detail = json['detail'];
  78. valid = json['valid'];
  79. }
  80. Map<String, dynamic> toJson() {
  81. final Map<String, dynamic> data = new Map<String, dynamic>();
  82. data['id'] = this.id;
  83. data['shop_id'] = this.shopId;
  84. data['game_id'] = this.gameId;
  85. data['name'] = this.name;
  86. data['logo'] = this.logo;
  87. data['price'] = this.price;
  88. data['detail'] = this.detail;
  89. data['valid'] = this.valid;
  90. return data;
  91. }
  92. }
  93. class ShopUser {
  94. int? score;
  95. ShopUser({this.score});
  96. ShopUser.fromJson(Map<String, dynamic> json) {
  97. score = json['score'];
  98. }
  99. Map<String, dynamic> toJson() {
  100. final Map<String, dynamic> data = new Map<String, dynamic>();
  101. data['score'] = this.score;
  102. return data;
  103. }
  104. }
  105. class ScoreList {
  106. List<ScoreListData>? data;
  107. ScoreList({this.data});
  108. ScoreList.fromJson(Map<String, dynamic> json) {
  109. if (json['data'] != null) {
  110. data = [];
  111. json['data'].forEach((v) {
  112. data!.add(new ScoreListData.fromJson(v));
  113. });
  114. }
  115. }
  116. Map<String, dynamic> toJson() {
  117. final Map<String, dynamic> data = new Map<String, dynamic>();
  118. if (this.data != null) {
  119. data['data'] = this.data!.map((v) => v.toJson()).toList();
  120. }
  121. return data;
  122. }
  123. }
  124. class ScoreListData {
  125. int? id;
  126. int? userId;
  127. int? score;
  128. String? from;
  129. String? detail;
  130. String? createdAt;
  131. ScoreListData(
  132. {this.id,
  133. this.userId,
  134. this.score,
  135. this.from,
  136. this.detail,
  137. this.createdAt});
  138. ScoreListData.fromJson(Map<String, dynamic> json) {
  139. id = json['id'];
  140. userId = json['user_id'];
  141. score = json['score'];
  142. from = json['from'];
  143. detail = json['detail'];
  144. createdAt = json['created_at'];
  145. }
  146. Map<String, dynamic> toJson() {
  147. final Map<String, dynamic> data = new Map<String, dynamic>();
  148. data['id'] = this.id;
  149. data['user_id'] = this.userId;
  150. data['score'] = this.score;
  151. data['from'] = this.from;
  152. data['detail'] = this.detail;
  153. data['created_at'] = this.createdAt;
  154. return data;
  155. }
  156. }