achievement_info.dart 12 KB

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