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.
152 lines
3.7 KiB
152 lines
3.7 KiB
/// id : "1455102859841372160" |
|
/// createTime : "2021-11-01 17:22:11" |
|
/// createUser : "1" |
|
/// updateTime : "2021-11-01 17:22:11" |
|
/// updateUser : "1" |
|
/// categoryId : "1452472226421932032" |
|
/// subject : "后会无期" |
|
/// tags : ["11"] |
|
/// coverImg : "https://pos.upload.gznl.top/0000/2021/11/d8305d15-1a39-4b08-a172-eba7f18b9968.jpg" |
|
/// author : {"name":"1","avatar":"1"} |
|
/// introduce : "1" |
|
/// viewers : 0 |
|
/// likes : 0 |
|
/// state : true |
|
/// isDelete : 0 |
|
|
|
class CourseDetails { |
|
CourseDetails({ |
|
String id, |
|
String createTime, |
|
String createUser, |
|
String updateTime, |
|
String updateUser, |
|
String categoryId, |
|
String subject, |
|
List<String> tags, |
|
String coverImg, |
|
Author author, |
|
String introduce, |
|
int viewers, |
|
int likes, |
|
bool state, |
|
int isDelete,}){ |
|
_id = id; |
|
_createTime = createTime; |
|
_createUser = createUser; |
|
_updateTime = updateTime; |
|
_updateUser = updateUser; |
|
_categoryId = categoryId; |
|
_subject = subject; |
|
_tags = tags; |
|
_coverImg = coverImg; |
|
_author = author; |
|
_introduce = introduce; |
|
_viewers = viewers; |
|
_likes = likes; |
|
_state = state; |
|
_isDelete = isDelete; |
|
} |
|
|
|
CourseDetails.fromJson(dynamic json) { |
|
_id = json['id']; |
|
_createTime = json['createTime']; |
|
_createUser = json['createUser']; |
|
_updateTime = json['updateTime']; |
|
_updateUser = json['updateUser']; |
|
_categoryId = json['categoryId']; |
|
_subject = json['subject']; |
|
_tags = json['tags'] != null ? json['tags'].cast<String>() : []; |
|
_coverImg = json['coverImg']; |
|
_author = json['author'] != null ? Author.fromJson(json['author']) : null; |
|
_introduce = json['introduce']; |
|
_viewers = json['viewers']; |
|
_likes = json['likes']; |
|
_state = json['state']; |
|
_isDelete = json['isDelete']; |
|
} |
|
String _id; |
|
String _createTime; |
|
String _createUser; |
|
String _updateTime; |
|
String _updateUser; |
|
String _categoryId; |
|
String _subject; |
|
List<String> _tags; |
|
String _coverImg; |
|
Author _author; |
|
String _introduce; |
|
int _viewers; |
|
int _likes; |
|
bool _state; |
|
int _isDelete; |
|
|
|
String get id => _id; |
|
String get createTime => _createTime; |
|
String get createUser => _createUser; |
|
String get updateTime => _updateTime; |
|
String get updateUser => _updateUser; |
|
String get categoryId => _categoryId; |
|
String get subject => _subject; |
|
List<String> get tags => _tags; |
|
String get coverImg => _coverImg; |
|
Author get author => _author; |
|
String get introduce => _introduce; |
|
int get viewers => _viewers; |
|
int get likes => _likes; |
|
bool get state => _state; |
|
int get isDelete => _isDelete; |
|
|
|
Map<String, dynamic> toJson() { |
|
final map = <String, dynamic>{}; |
|
map['id'] = _id; |
|
map['createTime'] = _createTime; |
|
map['createUser'] = _createUser; |
|
map['updateTime'] = _updateTime; |
|
map['updateUser'] = _updateUser; |
|
map['categoryId'] = _categoryId; |
|
map['subject'] = _subject; |
|
map['tags'] = _tags; |
|
map['coverImg'] = _coverImg; |
|
if (_author != null) { |
|
map['author'] = _author.toJson(); |
|
} |
|
map['introduce'] = _introduce; |
|
map['viewers'] = _viewers; |
|
map['likes'] = _likes; |
|
map['state'] = _state; |
|
map['isDelete'] = _isDelete; |
|
return map; |
|
} |
|
|
|
} |
|
|
|
/// name : "1" |
|
/// avatar : "1" |
|
|
|
class Author { |
|
Author({ |
|
String name, |
|
String avatar,}){ |
|
_name = name; |
|
_avatar = avatar; |
|
} |
|
|
|
Author.fromJson(dynamic json) { |
|
_name = json['name']; |
|
_avatar = json['avatar']; |
|
} |
|
String _name; |
|
String _avatar; |
|
|
|
String get name => _name; |
|
String get avatar => _avatar; |
|
|
|
Map<String, dynamic> toJson() { |
|
final map = <String, dynamic>{}; |
|
map['name'] = _name; |
|
map['avatar'] = _avatar; |
|
return map; |
|
} |
|
|
|
} |