game_record_sum.dart 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. import 'package:sport/bean/game.dart';
  2. import 'package:sport/services/Converter.dart';
  3. class GameRecordSum {
  4. int id;
  5. int userId;
  6. int gameId;
  7. String lastPlayAt;
  8. int times;
  9. int duration;
  10. double score;
  11. int consume;
  12. double scoreMax;
  13. int stepCount;
  14. int jumpCount;
  15. int crouchCount;
  16. int durationAvg;
  17. int scoreAvg;
  18. int consumePerMin;
  19. int durationTotalMinute;
  20. GameInfoData game;
  21. GameRecordSum(
  22. {this.id,
  23. this.userId,
  24. this.gameId,
  25. this.lastPlayAt,
  26. this.times,
  27. this.duration,
  28. this.score,
  29. this.consume,
  30. this.scoreMax,
  31. this.stepCount,
  32. this.jumpCount,
  33. this.crouchCount,
  34. this.durationAvg,
  35. this.scoreAvg,
  36. this.consumePerMin,
  37. this.durationTotalMinute});
  38. GameRecordSum.fromJson(Map<String, dynamic> json) {
  39. id = json['id'];
  40. userId = json['user_id'];
  41. gameId = json['game_id'];
  42. lastPlayAt = json['last_play_at'];
  43. times = json['times'];
  44. duration = json['duration'];
  45. score = Converter.toDouble(json['score']);
  46. consume = json['consume'];
  47. scoreMax = Converter.toDouble(json['score_max']);
  48. stepCount = json['step_count'];
  49. jumpCount = json['jump_count'];
  50. crouchCount = json['crouch_count'];
  51. durationAvg = json['duration_avg'];
  52. scoreAvg = json['score_avg'];
  53. consumePerMin = json['consume_per_min'];
  54. durationTotalMinute = json['duration_minute'];
  55. game = json['game'] != null ? new GameInfoData.fromJson(json['game']) : null;
  56. }
  57. Map<String, dynamic> toJson() {
  58. final Map<String, dynamic> data = new Map<String, dynamic>();
  59. data['id'] = this.id;
  60. data['user_id'] = this.userId;
  61. data['game_id'] = this.gameId;
  62. data['last_play_at'] = this.lastPlayAt;
  63. data['times'] = this.times;
  64. data['duration'] = this.duration;
  65. data['score'] = this.score;
  66. data['consume'] = this.consume;
  67. data['score_max'] = this.scoreMax;
  68. data['step_count'] = this.stepCount;
  69. data['jump_count'] = this.jumpCount;
  70. data['crouch_count'] = this.crouchCount;
  71. data['duration_avg'] = this.durationAvg;
  72. data['score_avg'] = this.scoreAvg;
  73. data['consume_per_min'] = this.consumePerMin;
  74. data['duration_minute'] = this.durationTotalMinute;
  75. return data;
  76. }
  77. }