notice.dart 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. import 'package:sport/bean/comment.dart';
  2. import 'package:sport/bean/post.dart';
  3. import 'package:sport/bean/post_user.dart';
  4. import 'package:sport/services/Converter.dart';
  5. class Notice {
  6. int? id;
  7. int? userId;
  8. String? isMessage;
  9. String? type;
  10. int? fromUserId;
  11. int? subjectId;
  12. int? commentId;
  13. int? feedbackId;
  14. int? receiveId;
  15. int? rankId;
  16. String? title;
  17. String? content;
  18. int? isRead;
  19. String? createdAt;
  20. int? createTime;
  21. PostUser? fromUserInfo;
  22. Post? subjectDetail;
  23. Comment? commentDetail;
  24. ReceiveDetail? receiveDetail;
  25. Notice(
  26. {this.id,
  27. this.userId,
  28. this.isMessage,
  29. this.type,
  30. this.fromUserId,
  31. this.subjectId,
  32. this.commentId,
  33. this.feedbackId,
  34. this.rankId,
  35. this.title,
  36. this.content,
  37. this.isRead,
  38. this.createdAt,
  39. this.createTime,
  40. this.fromUserInfo,
  41. this.subjectDetail,
  42. this.commentDetail});
  43. Notice.fromJson(Map<String, dynamic> json) {
  44. id = Converter.toInt(json['id']);
  45. userId = Converter.toInt(json['user_id']);
  46. isMessage = json['is_message'];
  47. type = json['type'];
  48. fromUserId = Converter.toInt(json['from_user_id']);
  49. subjectId = Converter.toInt(json['subject_id']);
  50. commentId = Converter.toInt(json['comment_id']);
  51. feedbackId = Converter.toInt(json['feedback_id']);
  52. rankId = Converter.toInt(json['rank_id']);
  53. receiveId = Converter.toInt(json['receive_id']);
  54. title = json['title'];
  55. content = json['content'];
  56. isRead = Converter.toInt(json['is_read']);
  57. createdAt = json['created_at'];
  58. createTime = json['create_time'];
  59. fromUserInfo = json['fromUserInfo'] != null && json['fromUserInfo'] is Map
  60. ? new PostUser.fromJson(json['fromUserInfo'])
  61. : null;
  62. subjectDetail = json['subjectDetail'] != null
  63. ? new Post.fromJson(json['subjectDetail'])
  64. : null;
  65. commentDetail = json['commentDetail'] != null
  66. ? new Comment.fromJson(json['commentDetail'])
  67. : null;
  68. receiveDetail = json['receiveDetail'] != null
  69. ? new ReceiveDetail.fromJson(json['receiveDetail'])
  70. : null;
  71. }
  72. Map<String, dynamic> toJson() {
  73. final Map<String, dynamic> data = new Map<String, dynamic>();
  74. data['id'] = this.id;
  75. data['user_id'] = this.userId;
  76. data['is_message'] = this.isMessage;
  77. data['type'] = this.type;
  78. data['from_user_id'] = this.fromUserId;
  79. data['subject_id'] = this.subjectId;
  80. data['comment_id'] = this.commentId;
  81. data['feedback_id'] = this.feedbackId;
  82. data['rank_id'] = this.rankId;
  83. data['content'] = this.content;
  84. data['is_read'] = this.isRead;
  85. data['created_at'] = this.createdAt;
  86. data['create_time'] = this.createTime;
  87. if (this.fromUserInfo != null) {
  88. data['fromUserInfo'] = this.fromUserInfo!.toJson();
  89. }
  90. if (this.subjectDetail != null) {
  91. data['subjectDetail'] = this.subjectDetail!.toJson();
  92. }
  93. if (this.commentDetail != null) {
  94. data['commentDetail'] = this.commentDetail!.toJson();
  95. }
  96. if (this.receiveDetail != null) {
  97. data['receiveDetail'] = this.receiveDetail!.toJson();
  98. }
  99. return data;
  100. }
  101. }
  102. class ReceiveDetail {
  103. String? id;
  104. String? userId;
  105. String? from;
  106. List<Thing>? thing;
  107. String? fromDetail;
  108. String? isReceive;
  109. String? createdAt;
  110. String? receivedAt;
  111. ReceiveDetail(
  112. {this.id,
  113. this.userId,
  114. this.from,
  115. this.thing,
  116. this.fromDetail,
  117. this.isReceive,
  118. this.createdAt,
  119. this.receivedAt});
  120. ReceiveDetail.fromJson(Map<String, dynamic> json) {
  121. id = json['id'];
  122. userId = json['user_id'];
  123. from = json['from'];
  124. if (json['thing'] != null) {
  125. thing = [];
  126. json['thing'].forEach((v) {
  127. thing!.add(new Thing.fromJson(v));
  128. });
  129. }
  130. fromDetail = json['from_detail'];
  131. isReceive = json['is_receive'];
  132. createdAt = json['created_at'];
  133. receivedAt = json['received_at'];
  134. }
  135. Map<String, dynamic> toJson() {
  136. final Map<String, dynamic> data = new Map<String, dynamic>();
  137. data['id'] = this.id;
  138. data['user_id'] = this.userId;
  139. data['from'] = this.from;
  140. if (this.thing != null) {
  141. data['thing'] = this.thing!.map((v) => v.toJson()).toList();
  142. }
  143. data['from_detail'] = this.fromDetail;
  144. data['is_receive'] = this.isReceive;
  145. data['created_at'] = this.createdAt;
  146. data['received_at'] = this.receivedAt;
  147. return data;
  148. }
  149. }
  150. class Thing {
  151. String? type;
  152. int? value;
  153. Thing({this.type, this.value});
  154. Thing.fromJson(Map<String, dynamic> json) {
  155. type = json['type'];
  156. value = json['value'];
  157. }
  158. Map<String, dynamic> toJson() {
  159. final Map<String, dynamic> data = new Map<String, dynamic>();
  160. data['type'] = this.type;
  161. data['value'] = this.value;
  162. return data;
  163. }
  164. }