123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- import 'package:sport/bean/comment.dart';
- import 'package:sport/bean/post.dart';
- import 'package:sport/bean/post_user.dart';
- import 'package:sport/services/Converter.dart';
- class Notice {
- int id;
- int userId;
- String isMessage;
- String type;
- int fromUserId;
- int subjectId;
- int commentId;
- int feedbackId;
- int receiveId;
- int rankId;
- String title;
- String content;
- int isRead;
- String createdAt;
- int createTime;
- PostUser fromUserInfo;
- Post subjectDetail;
- Comment commentDetail;
- ReceiveDetail receiveDetail;
- Notice(
- {this.id,
- this.userId,
- this.isMessage,
- this.type,
- this.fromUserId,
- this.subjectId,
- this.commentId,
- this.feedbackId,
- this.rankId,
- this.title,
- this.content,
- this.isRead,
- this.createdAt,
- this.createTime,
- this.fromUserInfo,
- this.subjectDetail,
- this.commentDetail});
- Notice.fromJson(Map<String, dynamic> json) {
- id = Converter.toInt(json['id']);
- userId = Converter.toInt(json['user_id']);
- isMessage = json['is_message'];
- type = json['type'];
- fromUserId = Converter.toInt(json['from_user_id']);
- subjectId = Converter.toInt(json['subject_id']);
- commentId = Converter.toInt(json['comment_id']);
- feedbackId = Converter.toInt(json['feedback_id']);
- rankId = Converter.toInt(json['rank_id']);
- receiveId = Converter.toInt(json['receive_id']);
- title = json['title'];
- content = json['content'];
- isRead = Converter.toInt(json['is_read']);
- createdAt = json['created_at'];
- createTime = json['create_time'];
- fromUserInfo = json['fromUserInfo'] != null && json['fromUserInfo'] is Map
- ? new PostUser.fromJson(json['fromUserInfo'])
- : null;
- subjectDetail = json['subjectDetail'] != null
- ? new Post.fromJson(json['subjectDetail'])
- : null;
- commentDetail = json['commentDetail'] != null
- ? new Comment.fromJson(json['commentDetail'])
- : null;
- receiveDetail = json['receiveDetail'] != null
- ? new ReceiveDetail.fromJson(json['receiveDetail'])
- : null;
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['user_id'] = this.userId;
- data['is_message'] = this.isMessage;
- data['type'] = this.type;
- data['from_user_id'] = this.fromUserId;
- data['subject_id'] = this.subjectId;
- data['comment_id'] = this.commentId;
- data['feedback_id'] = this.feedbackId;
- data['rank_id'] = this.rankId;
- data['content'] = this.content;
- data['is_read'] = this.isRead;
- data['created_at'] = this.createdAt;
- data['create_time'] = this.createTime;
- if (this.fromUserInfo != null) {
- data['fromUserInfo'] = this.fromUserInfo.toJson();
- }
- if (this.subjectDetail != null) {
- data['subjectDetail'] = this.subjectDetail.toJson();
- }
- if (this.commentDetail != null) {
- data['commentDetail'] = this.commentDetail.toJson();
- }
- if (this.receiveDetail != null) {
- data['receiveDetail'] = this.receiveDetail.toJson();
- }
- return data;
- }
- }
- class ReceiveDetail {
- String id;
- String userId;
- String from;
- List<Thing> thing;
- String fromDetail;
- String isReceive;
- String createdAt;
- String receivedAt;
- ReceiveDetail(
- {this.id,
- this.userId,
- this.from,
- this.thing,
- this.fromDetail,
- this.isReceive,
- this.createdAt,
- this.receivedAt});
- ReceiveDetail.fromJson(Map<String, dynamic> json) {
- id = json['id'];
- userId = json['user_id'];
- from = json['from'];
- if (json['thing'] != null) {
- thing = new List<Thing>();
- json['thing'].forEach((v) {
- thing.add(new Thing.fromJson(v));
- });
- }
- fromDetail = json['from_detail'];
- isReceive = json['is_receive'];
- createdAt = json['created_at'];
- receivedAt = json['received_at'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['id'] = this.id;
- data['user_id'] = this.userId;
- data['from'] = this.from;
- if (this.thing != null) {
- data['thing'] = this.thing.map((v) => v.toJson()).toList();
- }
- data['from_detail'] = this.fromDetail;
- data['is_receive'] = this.isReceive;
- data['created_at'] = this.createdAt;
- data['received_at'] = this.receivedAt;
- return data;
- }
- }
- class Thing {
- String type;
- int value;
- Thing({this.type, this.value});
- Thing.fromJson(Map<String, dynamic> json) {
- type = json['type'];
- value = json['value'];
- }
- Map<String, dynamic> toJson() {
- final Map<String, dynamic> data = new Map<String, dynamic>();
- data['type'] = this.type;
- data['value'] = this.value;
- return data;
- }
- }
|