achievement_info.dart 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. import 'package:sport/bean/rank_game_info.dart';
  2. import 'package:sport/bean/user.dart';
  3. import 'package:sport/services/Converter.dart';
  4. class AchievementInfo {
  5. int? result;
  6. int? code;
  7. String? msg;
  8. AchievementInfoData? data;
  9. AchievementInfo({this.result, this.code, this.msg, this.data});
  10. AchievementInfo.fromJson(Map<String, dynamic> json) {
  11. result = json['result'];
  12. code = json['code'];
  13. msg = json['msg'];
  14. data = json['data'] != null
  15. ? new AchievementInfoData.fromJson(json['data'])
  16. : null;
  17. }
  18. Map<String, dynamic> toJson() {
  19. final Map<String, dynamic> data = new Map<String, dynamic>();
  20. data['result'] = this.result;
  21. data['code'] = this.code;
  22. data['msg'] = this.msg;
  23. if (this.data != null) {
  24. data['data'] = this.data!.toJson();
  25. }
  26. return data;
  27. }
  28. }
  29. //class AchievementInfoData {
  30. // List<Achievement>? achievements;
  31. // List<Achievement>? remainAchievements;
  32. // List<Levels>? levels;
  33. // User user;
  34. // Extra extra;
  35. //
  36. // AchievementInfoData({this.achievements, this.remainAchievements, this.levels, this.user, this.extra});
  37. //
  38. // AchievementInfoData.fromJson(Map<String, dynamic> json) {
  39. // if (json['achievements'] != null) {
  40. // achievements = new List<Achievement>?();
  41. // json['achievements'].forEach((v) {
  42. // achievements!.add(new Achievement.fromJson(v));
  43. // });
  44. // }
  45. // if (json['remain_achievements'] != null) {
  46. // remainAchievements = new List<Achievement>?();
  47. // json['remain_achievements'].forEach((v) {
  48. // remainAchievements!.add(new Achievement.fromJson(v));
  49. // });
  50. // }
  51. // if (json['levels'] != null) {
  52. // levels = new List<Levels>?();
  53. // json['levels'].forEach((v) {
  54. // levels!.add(new Levels.fromJson(v));
  55. // });
  56. // }
  57. // user = json['user'] != null ? new User.fromJson(json['user']) : null;
  58. // extra = json['extra'] != null ? new Extra.fromJson(json['extra']) : null;
  59. // }
  60. //
  61. // Map<String, dynamic> toJson() {
  62. // final Map<String, dynamic> data = new Map<String, dynamic>();
  63. // if (this.achievements != null) {
  64. // data['achievements'] = this.achievements!.map((v) => v.toJson()).toList();
  65. // }
  66. // if (this.remainAchievements != null) {
  67. // data['remain_achievements'] = this.remainAchievements!.map((v) => v.toJson()).toList();
  68. // }
  69. // if (this.levels != null) {
  70. // data['levels'] = this.levels!.map((v) => v.toJson()).toList();
  71. // }
  72. // if (this.user != null) {
  73. // data['user'] = this.user!.toJson();
  74. // }
  75. // if (this.extra != null) {
  76. // data['extra'] = this.extra!.toJson();
  77. // }
  78. // return data;
  79. // }
  80. //}
  81. //class Levels {
  82. // int? id;
  83. // int? level;
  84. // int? score;
  85. // String? logo;
  86. //
  87. // Levels({this.id, this.level, this.score, this.logo});
  88. //
  89. // Levels.fromJson(Map<String, dynamic> json) {
  90. // id = json['id'];
  91. // level = json['level'];
  92. // score = json['score'];
  93. // logo = json['logo'];
  94. // }
  95. //
  96. // Map<String, dynamic> toJson() {
  97. // final Map<String, dynamic> data = new Map<String, dynamic>();
  98. // data['id'] = this.id;
  99. // data['level'] = this.level;
  100. // data['score'] = this.score;
  101. // data['logo'] = this.logo;
  102. // return data;
  103. // }
  104. //}
  105. //
  106. //class User {
  107. // int? id;
  108. // String? name;
  109. // int? sportTargetId;
  110. // int? topSubjectId;
  111. // int? level;
  112. // int? score;
  113. // int? isBan;
  114. // int? provinceId;
  115. // int? cityId;
  116. // int? districtId;
  117. // String? createdAt;
  118. // int? gender;
  119. // int? age;
  120. // String? avatar;
  121. // String? province;
  122. // String? city;
  123. // String? district;
  124. // SportRecordSum sportRecordSum;
  125. // List<Achievement>? achievements;
  126. // Levels levelInfo;
  127. //
  128. // User(
  129. // {this.id,
  130. // this.name,
  131. // this.sportTargetId,
  132. // this.topSubjectId,
  133. // this.level,
  134. // this.score,
  135. // this.isBan,
  136. // this.provinceId,
  137. // this.cityId,
  138. // this.districtId,
  139. // this.createdAt,
  140. // this.gender,
  141. // this.age,
  142. // this.avatar,
  143. // this.province,
  144. // this.city,
  145. // this.district,
  146. // this.sportRecordSum,
  147. // this.achievements,
  148. // this.levelInfo});
  149. //
  150. // User.fromJson(Map<String, dynamic> json) {
  151. // id = json['id'];
  152. // name = json['name'];
  153. // sportTargetId = json['sport_target_id'];
  154. // topSubjectId = json['top_subject_id'];
  155. // level = json['level'];
  156. // score = json['score'];
  157. // isBan = json['is_ban'];
  158. // provinceId = json['province_id'];
  159. // cityId = json['city_id'];
  160. // districtId = json['district_id'];
  161. // createdAt = json['created_at'];
  162. // gender = json['gender'];
  163. // age = json['age'];
  164. // avatar = json['avatar'];
  165. // province = json['province'];
  166. // city = json['city'];
  167. // district = json['district'];
  168. // sportRecordSum = json['sport_record_sum'] != null ? new SportRecordSum.fromJson(json['sport_record_sum']) : null;
  169. // if (json['achievements'] != null) {
  170. // achievements = new List<Achievement>?();
  171. // json['achievements'].forEach((v) {
  172. // achievements!.add(new Achievement.fromJson(v));
  173. // });
  174. // }
  175. //
  176. // levelInfo = json['level_info'] != null ? new Levels.fromJson(json['level_info']) : null;
  177. // }
  178. //
  179. // Map<String, dynamic> toJson() {
  180. // final Map<String, dynamic> data = new Map<String, dynamic>();
  181. // data['id'] = this.id;
  182. // data['name'] = this.name;
  183. // data['sport_target_id'] = this.sportTargetId;
  184. // data['top_subject_id'] = this.topSubjectId;
  185. // data['level'] = this.level;
  186. // data['score'] = this.score;
  187. // data['is_ban'] = this.isBan;
  188. // data['province_id'] = this.provinceId;
  189. // data['city_id'] = this.cityId;
  190. // data['district_id'] = this.districtId;
  191. // data['created_at'] = this.createdAt;
  192. // data['gender'] = this.gender;
  193. // data['age'] = this.age;
  194. // data['avatar'] = this.avatar;
  195. // data['province'] = this.province;
  196. // data['city'] = this.city;
  197. // data['district'] = this.district;
  198. // if (this.sportRecordSum != null) {
  199. // data['sport_record_sum'] = this.sportRecordSum!.toJson();
  200. // }
  201. // if (this.achievements != null) {
  202. // data['achievements'] = this.achievements!.map((v) => v.toJson()).toList();
  203. // }
  204. // return data;
  205. // }
  206. //}
  207. //
  208. //class SportRecordSum {
  209. // int? id;
  210. // int? userId;
  211. // int? consume;
  212. // int? duration;
  213. // int? jumpCount;
  214. // int? crouchCount;
  215. //
  216. // SportRecordSum({this.id, this.userId, this.consume, this.duration, this.jumpCount, this.crouchCount});
  217. //
  218. // SportRecordSum.fromJson(Map<String, dynamic> json) {
  219. // id = json['id'];
  220. // userId = json['user_id'];
  221. // consume = json['consume'];
  222. // duration = json['duration'];
  223. // jumpCount = json['jump_count'];
  224. // crouchCount = json['crouch_count'];
  225. // }
  226. //
  227. // Map<String, dynamic> toJson() {
  228. // final Map<String, dynamic> data = new Map<String, dynamic>();
  229. // data['id'] = this.id;
  230. // data['user_id'] = this.userId;
  231. // data['consume'] = this.consume;
  232. // data['duration'] = this.duration;
  233. // data['jump_count'] = this.jumpCount;
  234. // data['crouch_count'] = this.crouchCount;
  235. // return data;
  236. // }
  237. //}
  238. //class Achievements {
  239. // int? id;
  240. // String? name;
  241. // String? logo;
  242. // int? conditionDuration;
  243. // int? sort;
  244. // int? seriesId;
  245. // int? rewardScore;
  246. // Null position;
  247. // String? createdAt;
  248. //
  249. // Achievements(
  250. // {this.id,
  251. // this.name,
  252. // this.logo,
  253. // this.conditionDuration,
  254. // this.sort,
  255. // this.seriesId,
  256. // this.rewardScore,
  257. // this.position,
  258. // this.createdAt});
  259. //
  260. // Achievements.fromJson(Map<String, dynamic> json) {
  261. // id = json['id'];
  262. // name = json['name'];
  263. // logo = json['logo'];
  264. // conditionDuration = json['condition_duration'];
  265. // sort = json['sort'];
  266. // seriesId = json['series_id'];
  267. // rewardScore = json['reward_score'];
  268. // position = json['position'];
  269. // createdAt = json['created_at'];
  270. // }
  271. //
  272. // Map<String, dynamic> toJson() {
  273. // final Map<String, dynamic> data = new Map<String, dynamic>();
  274. // data['id'] = this.id;
  275. // data['name'] = this.name;
  276. // data['logo'] = this.logo;
  277. // data['condition_duration'] = this.conditionDuration;
  278. // data['sort'] = this.sort;
  279. // data['series_id'] = this.seriesId;
  280. // data['reward_score'] = this.rewardScore;
  281. // data['position'] = this.position;
  282. // data['created_at'] = this.createdAt;
  283. // return data;
  284. // }
  285. //}
  286. class AchievementInfoData {
  287. Level? level;
  288. int? score;
  289. int exp = 0;
  290. int nextLevelExp = 0;
  291. int? allAchievementCount;
  292. int? getAchievementCount;
  293. double? getAchievementPercent;
  294. List<Achievement>? getAchievementList;
  295. List<Achievement>? remainAchievementList;
  296. AchievementInfoData(
  297. {this.level,
  298. this.score,
  299. this.exp = 0,
  300. this.nextLevelExp= 0,
  301. this.allAchievementCount,
  302. this.getAchievementCount,
  303. this.getAchievementPercent,
  304. this.getAchievementList,
  305. this.remainAchievementList});
  306. AchievementInfoData.fromJson(Map<String, dynamic> json) {
  307. level = json['level'] != null ? new Level.fromJson(json['level']) : null;
  308. score = json['score'];
  309. exp = json['exp'] ?? 0;
  310. nextLevelExp = json['next_level_exp'] ??0;
  311. allAchievementCount = json['all_achievement_count'];
  312. getAchievementCount = json['get_achievement_count'];
  313. getAchievementPercent = Converter.toDouble(json['get_achievement_percent']);
  314. getAchievementList = <Achievement>[];
  315. if (json['get_achievement_list'] != null) {
  316. json['get_achievement_list'].forEach((v) {
  317. getAchievementList!.add(new Achievement.fromJson(v));
  318. });
  319. }
  320. remainAchievementList = <Achievement>[];
  321. if (json['remain_achievement_list'] != null) {
  322. json['remain_achievement_list'].forEach((v) {
  323. remainAchievementList!.add(new Achievement.fromJson(v));
  324. });
  325. }
  326. }
  327. Map<String, dynamic> toJson() {
  328. final Map<String, dynamic> data = new Map<String, dynamic>();
  329. if (this.level != null) {
  330. data['level'] = this.level!.toJson();
  331. }
  332. data['score'] = this.score;
  333. data['exp'] = this.exp;
  334. data['next_level_exp'] = this.nextLevelExp;
  335. data['all_achievement_count'] = this.allAchievementCount;
  336. data['get_achievement_count'] = this.getAchievementCount;
  337. data['get_achievement_percent'] = this.getAchievementPercent;
  338. if (this.getAchievementList != null) {
  339. data['get_achievement_list'] =
  340. this.getAchievementList!.map((v) => v.toJson()).toList();
  341. }
  342. if (this.remainAchievementList != null) {
  343. data['remain_achievement_list'] =
  344. this.remainAchievementList!.map((v) => v.toJson()).toList();
  345. }
  346. return data;
  347. }
  348. }
  349. class Level {
  350. int? level;
  351. String? logo;
  352. Level({this.level, this.logo});
  353. Level.fromJson(Map<String, dynamic> json) {
  354. level = json['level'];
  355. logo = json['logo'];
  356. }
  357. Map<String, dynamic> toJson() {
  358. final Map<String, dynamic> data = new Map<String, dynamic>();
  359. data['level'] = this.level;
  360. data['logo'] = this.logo;
  361. return data;
  362. }
  363. }
  364. class Extra {
  365. NextLevel? nextLevel;
  366. NextLevel? nextAchievement;
  367. Extra({this.nextLevel, this.nextAchievement});
  368. Extra.fromJson(Map<String, dynamic> json) {
  369. nextLevel = json['next_level'] != null
  370. ? new NextLevel.fromJson(json['next_level'])
  371. : null;
  372. nextAchievement = json['next_achievement'] != null
  373. ? new NextLevel.fromJson(json['next_achievement'])
  374. : null;
  375. }
  376. Map<String, dynamic> toJson() {
  377. final Map<String, dynamic> data = new Map<String, dynamic>();
  378. if (this.nextLevel != null) {
  379. data['next_level'] = this.nextLevel!.toJson();
  380. }
  381. if (this.nextAchievement != null) {
  382. data['next_achievement'] = this.nextAchievement!.toJson();
  383. }
  384. return data;
  385. }
  386. }
  387. class NextLevel {
  388. Achievement? target;
  389. int? diff;
  390. NextLevel({this.target, this.diff});
  391. NextLevel.fromJson(Map<String, dynamic> json) {
  392. target = json['target'] != null
  393. ? new Achievement.fromJson(json['target'])
  394. : null;
  395. diff = json['diff'];
  396. }
  397. Map<String, dynamic> toJson() {
  398. final Map<String, dynamic> data = new Map<String, dynamic>();
  399. if (this.target != null) {
  400. data['target'] = this.target!.toJson();
  401. }
  402. data['diff'] = this.diff;
  403. return data;
  404. }
  405. }