123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428 |
- import 'package:sport/bean/rank_game_info.dart';
- import 'package:sport/bean/user.dart';
- import 'package:sport/services/Converter.dart';
- class AchievementInfo {
- int? result;
- int? code;
- String? msg;
- AchievementInfoData? data;
- AchievementInfo({this.result, this.code, this.msg, this.data});
- AchievementInfo.fromJson(Map<String, dynamic> json) {
- result = json['result'];
- code = json['code'];
- msg = json['msg'];
- data = json['data'] != null
- ? new AchievementInfoData.fromJson(json['data'])
- : null;
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['result'] = this.result;
- data['code'] = this.code;
- data['msg'] = this.msg;
- if (this.data != null) {
- data['data'] = this.data!.toJson();
- }
- return data;
- }
- }
- //class AchievementInfoData {
- // List<Achievement>? achievements;
- // List<Achievement>? remainAchievements;
- // List<Levels>? levels;
- // User user;
- // Extra extra;
- //
- // AchievementInfoData({this.achievements, this.remainAchievements, this.levels, this.user, this.extra});
- //
- // AchievementInfoData.fromJson(Map<String, dynamic> json) {
- // if (json['achievements'] != null) {
- // achievements = new List<Achievement>?();
- // json['achievements'].forEach((v) {
- // achievements!.add(new Achievement.fromJson(v));
- // });
- // }
- // if (json['remain_achievements'] != null) {
- // remainAchievements = new List<Achievement>?();
- // json['remain_achievements'].forEach((v) {
- // remainAchievements!.add(new Achievement.fromJson(v));
- // });
- // }
- // if (json['levels'] != null) {
- // levels = new List<Levels>?();
- // json['levels'].forEach((v) {
- // levels!.add(new Levels.fromJson(v));
- // });
- // }
- // user = json['user'] != null ? new User.fromJson(json['user']) : null;
- // extra = json['extra'] != null ? new Extra.fromJson(json['extra']) : null;
- // }
- //
- // Map<String, dynamic> toJson() {
- // final Map<String, dynamic> data = new Map<String, dynamic>();
- // if (this.achievements != null) {
- // data['achievements'] = this.achievements!.map((v) => v.toJson()).toList();
- // }
- // if (this.remainAchievements != null) {
- // data['remain_achievements'] = this.remainAchievements!.map((v) => v.toJson()).toList();
- // }
- // if (this.levels != null) {
- // data['levels'] = this.levels!.map((v) => v.toJson()).toList();
- // }
- // if (this.user != null) {
- // data['user'] = this.user!.toJson();
- // }
- // if (this.extra != null) {
- // data['extra'] = this.extra!.toJson();
- // }
- // return data;
- // }
- //}
- //class Levels {
- // int? id;
- // int? level;
- // int? score;
- // String? logo;
- //
- // Levels({this.id, this.level, this.score, this.logo});
- //
- // Levels.fromJson(Map<String, dynamic> json) {
- // id = json['id'];
- // level = json['level'];
- // score = json['score'];
- // logo = json['logo'];
- // }
- //
- // Map<String, dynamic> toJson() {
- // final Map<String, dynamic> data = new Map<String, dynamic>();
- // data['id'] = this.id;
- // data['level'] = this.level;
- // data['score'] = this.score;
- // data['logo'] = this.logo;
- // return data;
- // }
- //}
- //
- //class User {
- // int? id;
- // String? name;
- // int? sportTargetId;
- // int? topSubjectId;
- // int? level;
- // int? score;
- // int? isBan;
- // int? provinceId;
- // int? cityId;
- // int? districtId;
- // String? createdAt;
- // int? gender;
- // int? age;
- // String? avatar;
- // String? province;
- // String? city;
- // String? district;
- // SportRecordSum sportRecordSum;
- // List<Achievement>? achievements;
- // Levels levelInfo;
- //
- // User(
- // {this.id,
- // this.name,
- // this.sportTargetId,
- // this.topSubjectId,
- // this.level,
- // this.score,
- // this.isBan,
- // this.provinceId,
- // this.cityId,
- // this.districtId,
- // this.createdAt,
- // this.gender,
- // this.age,
- // this.avatar,
- // this.province,
- // this.city,
- // this.district,
- // this.sportRecordSum,
- // this.achievements,
- // this.levelInfo});
- //
- // User.fromJson(Map<String, dynamic> json) {
- // id = json['id'];
- // name = json['name'];
- // sportTargetId = json['sport_target_id'];
- // topSubjectId = json['top_subject_id'];
- // level = json['level'];
- // score = json['score'];
- // isBan = json['is_ban'];
- // provinceId = json['province_id'];
- // cityId = json['city_id'];
- // districtId = json['district_id'];
- // createdAt = json['created_at'];
- // gender = json['gender'];
- // age = json['age'];
- // avatar = json['avatar'];
- // province = json['province'];
- // city = json['city'];
- // district = json['district'];
- // sportRecordSum = json['sport_record_sum'] != null ? new SportRecordSum.fromJson(json['sport_record_sum']) : null;
- // if (json['achievements'] != null) {
- // achievements = new List<Achievement>?();
- // json['achievements'].forEach((v) {
- // achievements!.add(new Achievement.fromJson(v));
- // });
- // }
- //
- // levelInfo = json['level_info'] != null ? new Levels.fromJson(json['level_info']) : null;
- // }
- //
- // Map<String, dynamic> toJson() {
- // final Map<String, dynamic> data = new Map<String, dynamic>();
- // data['id'] = this.id;
- // data['name'] = this.name;
- // data['sport_target_id'] = this.sportTargetId;
- // data['top_subject_id'] = this.topSubjectId;
- // data['level'] = this.level;
- // data['score'] = this.score;
- // data['is_ban'] = this.isBan;
- // data['province_id'] = this.provinceId;
- // data['city_id'] = this.cityId;
- // data['district_id'] = this.districtId;
- // data['created_at'] = this.createdAt;
- // data['gender'] = this.gender;
- // data['age'] = this.age;
- // data['avatar'] = this.avatar;
- // data['province'] = this.province;
- // data['city'] = this.city;
- // data['district'] = this.district;
- // if (this.sportRecordSum != null) {
- // data['sport_record_sum'] = this.sportRecordSum!.toJson();
- // }
- // if (this.achievements != null) {
- // data['achievements'] = this.achievements!.map((v) => v.toJson()).toList();
- // }
- // return data;
- // }
- //}
- //
- //class SportRecordSum {
- // int? id;
- // int? userId;
- // int? consume;
- // int? duration;
- // int? jumpCount;
- // int? crouchCount;
- //
- // SportRecordSum({this.id, this.userId, this.consume, this.duration, this.jumpCount, this.crouchCount});
- //
- // SportRecordSum.fromJson(Map<String, dynamic> json) {
- // id = json['id'];
- // userId = json['user_id'];
- // consume = json['consume'];
- // duration = json['duration'];
- // jumpCount = json['jump_count'];
- // crouchCount = json['crouch_count'];
- // }
- //
- // Map<String, dynamic> toJson() {
- // final Map<String, dynamic> data = new Map<String, dynamic>();
- // data['id'] = this.id;
- // data['user_id'] = this.userId;
- // data['consume'] = this.consume;
- // data['duration'] = this.duration;
- // data['jump_count'] = this.jumpCount;
- // data['crouch_count'] = this.crouchCount;
- // return data;
- // }
- //}
- //class Achievements {
- // int? id;
- // String? name;
- // String? logo;
- // int? conditionDuration;
- // int? sort;
- // int? seriesId;
- // int? rewardScore;
- // Null position;
- // String? createdAt;
- //
- // Achievements(
- // {this.id,
- // this.name,
- // this.logo,
- // this.conditionDuration,
- // this.sort,
- // this.seriesId,
- // this.rewardScore,
- // this.position,
- // this.createdAt});
- //
- // Achievements.fromJson(Map<String, dynamic> json) {
- // id = json['id'];
- // name = json['name'];
- // logo = json['logo'];
- // conditionDuration = json['condition_duration'];
- // sort = json['sort'];
- // seriesId = json['series_id'];
- // rewardScore = json['reward_score'];
- // position = json['position'];
- // createdAt = json['created_at'];
- // }
- //
- // Map<String, dynamic> toJson() {
- // final Map<String, dynamic> data = new Map<String, dynamic>();
- // data['id'] = this.id;
- // data['name'] = this.name;
- // data['logo'] = this.logo;
- // data['condition_duration'] = this.conditionDuration;
- // data['sort'] = this.sort;
- // data['series_id'] = this.seriesId;
- // data['reward_score'] = this.rewardScore;
- // data['position'] = this.position;
- // data['created_at'] = this.createdAt;
- // return data;
- // }
- //}
- class AchievementInfoData {
- Level? level;
- int? score;
- int exp = 0;
- int nextLevelExp = 0;
- int? allAchievementCount;
- int? getAchievementCount;
- double? getAchievementPercent;
- List<Achievement>? getAchievementList;
- List<Achievement>? remainAchievementList;
- AchievementInfoData(
- {this.level,
- this.score,
- this.exp = 0,
- this.nextLevelExp= 0,
- this.allAchievementCount,
- this.getAchievementCount,
- this.getAchievementPercent,
- this.getAchievementList,
- this.remainAchievementList});
- AchievementInfoData.fromJson(Map<String, dynamic> json) {
- level = json['level'] != null ? new Level.fromJson(json['level']) : null;
- score = json['score'];
- exp = json['exp'] ?? 0;
- nextLevelExp = json['next_level_exp'] ??0;
- allAchievementCount = json['all_achievement_count'];
- getAchievementCount = json['get_achievement_count'];
- getAchievementPercent = Converter.toDouble(json['get_achievement_percent']);
- getAchievementList = <Achievement>[];
- if (json['get_achievement_list'] != null) {
- json['get_achievement_list'].forEach((v) {
- getAchievementList!.add(new Achievement.fromJson(v));
- });
- }
- remainAchievementList = <Achievement>[];
- if (json['remain_achievement_list'] != null) {
- json['remain_achievement_list'].forEach((v) {
- remainAchievementList!.add(new Achievement.fromJson(v));
- });
- }
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- if (this.level != null) {
- data['level'] = this.level!.toJson();
- }
- data['score'] = this.score;
- data['exp'] = this.exp;
- data['next_level_exp'] = this.nextLevelExp;
- data['all_achievement_count'] = this.allAchievementCount;
- data['get_achievement_count'] = this.getAchievementCount;
- data['get_achievement_percent'] = this.getAchievementPercent;
- if (this.getAchievementList != null) {
- data['get_achievement_list'] =
- this.getAchievementList!.map((v) => v.toJson()).toList();
- }
- if (this.remainAchievementList != null) {
- data['remain_achievement_list'] =
- this.remainAchievementList!.map((v) => v.toJson()).toList();
- }
- return data;
- }
- }
- class Level {
- int? level;
- String? logo;
- Level({this.level, this.logo});
- Level.fromJson(Map<String, dynamic> json) {
- level = json['level'];
- logo = json['logo'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['level'] = this.level;
- data['logo'] = this.logo;
- return data;
- }
- }
- class Extra {
- NextLevel? nextLevel;
- NextLevel? nextAchievement;
- Extra({this.nextLevel, this.nextAchievement});
- Extra.fromJson(Map<String, dynamic> json) {
- nextLevel = json['next_level'] != null
- ? new NextLevel.fromJson(json['next_level'])
- : null;
- nextAchievement = json['next_achievement'] != null
- ? new NextLevel.fromJson(json['next_achievement'])
- : null;
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- if (this.nextLevel != null) {
- data['next_level'] = this.nextLevel!.toJson();
- }
- if (this.nextAchievement != null) {
- data['next_achievement'] = this.nextAchievement!.toJson();
- }
- return data;
- }
- }
- class NextLevel {
- Achievement? target;
- int? diff;
- NextLevel({this.target, this.diff});
- NextLevel.fromJson(Map<String, dynamic> json) {
- target = json['target'] != null
- ? new Achievement.fromJson(json['target'])
- : null;
- diff = json['diff'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- if (this.target != null) {
- data['target'] = this.target!.toJson();
- }
- data['diff'] = this.diff;
- return data;
- }
- }
|