message_model.dart 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. class MessageModel {
  2. List<Records> records;
  3. MessageModel({this.records});
  4. MessageModel.fromJson(Map<String, dynamic> json) {
  5. if (json['records'] != null) {
  6. records = new List<Records>();
  7. json['records'].forEach((v) {
  8. records.add(new Records.fromJson(v));
  9. });
  10. }
  11. }
  12. Map<String, dynamic> toJson() {
  13. final Map<String, dynamic> data = new Map<String, dynamic>();
  14. if (this.records != null) {
  15. data['records'] = this.records.map((v) => v.toJson()).toList();
  16. }
  17. return data;
  18. }
  19. }
  20. class Records {
  21. String id;
  22. String userId;
  23. String content;
  24. int type;
  25. int viewFlag;
  26. int deviceModel;
  27. String createUserId;
  28. String createTime;
  29. Records(
  30. {this.id,
  31. this.userId,
  32. this.content,
  33. this.type,
  34. this.viewFlag,
  35. this.deviceModel,
  36. this.createUserId,
  37. this.createTime});
  38. Records.fromJson(Map<String, dynamic> json) {
  39. if (json == null) return;
  40. id = json['id'];
  41. userId = json['userId'];
  42. content = json['content'];
  43. type = json['type'];
  44. viewFlag = json['viewFlag'];
  45. deviceModel = json['deviceModel'];
  46. createUserId = json['createUserId'];
  47. createTime = json['createTime'];
  48. }
  49. Map<String, dynamic> toJson() {
  50. final Map<String, dynamic> data = new Map<String, dynamic>();
  51. data['id'] = this.id;
  52. data['userId'] = this.userId;
  53. data['content'] = this.content;
  54. data['type'] = this.type;
  55. data['viewFlag'] = this.viewFlag;
  56. data['deviceModel'] = this.deviceModel;
  57. data['createUserId'] = this.createUserId;
  58. data['createTime'] = this.createTime;
  59. return data;
  60. }
  61. }
  62. class MessageOverview {
  63. int systemMessageUnreadCount;
  64. int notificationMessageUnreadCount;
  65. Records systemMessageModel;
  66. Records notificationMessageModel;
  67. MessageOverview.fromJson(Map<String, dynamic> json) {
  68. Map<String, dynamic> systemMessage = json['系统消息'];
  69. systemMessageUnreadCount = systemMessage["count"];
  70. systemMessageModel = Records.fromJson(systemMessage['timeMessage']);
  71. Map<String, dynamic> notificationMessage = json['通知消息'];
  72. notificationMessageUnreadCount = notificationMessage['count'];
  73. notificationMessageModel =
  74. Records.fromJson(notificationMessage['timeMessage']);
  75. }
  76. }