You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aku_new_community/lib/model/community/event_item_model.dart

162 lines
4.4 KiB

3 years ago
import 'package:aku_new_community/model/common/img_model.dart';
import 'package:flustars/flustars.dart';
class EventItemModel {
4 years ago
int? id;
int? createId;
int? isComment;
int? isLike;
String? createName;
String? content;
String? gambitTitle;
String? createDate;
List<LikeNames>? likeNames;
num? likeNamesNum;
4 years ago
List<ImgModel>? imgUrls;
List<ImgModel>? headSculptureImgUrl;
num? gambitThemeCommentNum;
4 years ago
List<GambitThemeCommentVoList>? gambitThemeCommentVoList;
num? views;
3 years ago
4 years ago
DateTime? get date => DateUtil.getDateTime(createDate!);
3 years ago
EventItemModel(
{this.id,
this.createId,
this.isComment,
this.isLike,
this.createName,
this.content,
this.gambitTitle,
this.createDate,
this.likeNames,
this.likeNamesNum,
this.imgUrls,
this.headSculptureImgUrl,
this.gambitThemeCommentVoList,this.gambitThemeCommentNum,this.views});
EventItemModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
createId = json['createId'];
isComment = json['isComment'];
isLike = json['isLike'];
createName = json['createName'];
content = json['content'];
gambitTitle = json['gambitTitle'];
createDate = json['createDate'];
likeNamesNum = json['likeNamesNum'];
views = json['views'];
gambitThemeCommentNum = json['gambitThemeCommentNum'];
if (json['likeNames'] != null) {
4 years ago
likeNames = [];
json['likeNames'].forEach((v) {
4 years ago
likeNames!.add(new LikeNames.fromJson(v));
});
} else
likeNames = [];
if (json['imgUrls'] != null) {
4 years ago
imgUrls = [];
json['imgUrls'].forEach((v) {
4 years ago
imgUrls!.add(new ImgModel.fromJson(v));
});
} else
imgUrls = [];
if (json['headSculptureImgUrl'] != null) {
4 years ago
headSculptureImgUrl = [];
json['headSculptureImgUrl'].forEach((v) {
4 years ago
headSculptureImgUrl!.add(new ImgModel.fromJson(v));
});
} else
headSculptureImgUrl = [];
if (json['gambitThemeCommentVoList'] != null) {
4 years ago
gambitThemeCommentVoList = [];
json['gambitThemeCommentVoList'].forEach((v) {
4 years ago
gambitThemeCommentVoList!.add(new GambitThemeCommentVoList.fromJson(v));
});
} else
gambitThemeCommentVoList = [];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['createId'] = this.createId;
data['isComment'] = this.isComment;
data['isLike'] = this.isLike;
data['createName'] = this.createName;
data['content'] = this.content;
data['gambitTitle'] = this.gambitTitle;
data['createDate'] = this.createDate;
data['likeNamesNum'] = this.likeNamesNum;
data['views'] = this.views;
data['gambitThemeCommentNum'] = this.gambitThemeCommentNum;
if (this.likeNames != null) {
4 years ago
data['likeNames'] = this.likeNames!.map((v) => v.toJson()).toList();
}
if (this.imgUrls != null) {
4 years ago
data['imgUrls'] = this.imgUrls!.map((v) => v.toJson()).toList();
}
if (this.headSculptureImgUrl != null) {
data['headSculptureImgUrl'] =
4 years ago
this.headSculptureImgUrl!.map((v) => v.toJson()).toList();
}
if (this.gambitThemeCommentVoList != null) {
data['gambitThemeCommentVoList'] =
4 years ago
this.gambitThemeCommentVoList!.map((v) => v.toJson()).toList();
}
return data;
}
}
class LikeNames {
4 years ago
int? id;
String? name;
LikeNames({this.id, this.name});
LikeNames.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}
class GambitThemeCommentVoList {
4 years ago
int? id;
String? parentName;
String? content;
String? createName;
String? createDate;
GambitThemeCommentVoList(
{this.id,
this.parentName,
this.content,
this.createName,
this.createDate});
GambitThemeCommentVoList.fromJson(Map<String, dynamic> json) {
id = json['id'];
parentName = json['parentName'];
content = json['content'];
createName = json['createName'];
createDate = json['createDate'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['parentName'] = this.parentName;
data['content'] = this.content;
data['createName'] = this.createName;
data['createDate'] = this.createDate;
return data;
}
}