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.
269 lines
5.8 KiB
269 lines
5.8 KiB
import 'dart:convert'; |
|
|
|
import 'package:huixiang/retrofit/data/author.dart'; |
|
|
|
|
|
class Article { |
|
String _id; |
|
String _createTime; |
|
dynamic _createUser; |
|
String _updateTime; |
|
dynamic _updateUser; |
|
String _storeId; |
|
String _mainTitle; |
|
dynamic _viceTitle; |
|
String _content; |
|
String _coverImg; |
|
dynamic _author; |
|
int _type; |
|
String _startTime; |
|
String _categoryId; |
|
String _endTime; |
|
int _state; |
|
int _isDelete; |
|
int _likes; |
|
bool _isHot; |
|
bool _liked; |
|
int _viewers; |
|
int _comments; |
|
String _authorName; |
|
String _authorHeadImg; |
|
bool isFollow; |
|
dynamic _storeName; |
|
|
|
String get id => _id; |
|
String get createTime => _createTime; |
|
dynamic get createUser => _createUser; |
|
String get updateTime => _updateTime; |
|
dynamic get updateUser => _updateUser; |
|
String get storeId => _storeId; |
|
String get mainTitle => _mainTitle; |
|
dynamic get viceTitle => _viceTitle; |
|
String get content => _content; |
|
String get coverImg => _coverImg; |
|
dynamic get author => _author; |
|
int get type => _type; |
|
String get startTime => _startTime; |
|
String get categoryId => _categoryId; |
|
String get endTime => _endTime; |
|
int get state => _state; |
|
int get isDelete => _isDelete; |
|
int get likes => _likes; |
|
bool get isHot => _isHot; |
|
bool get liked => _liked; |
|
int get viewers => _viewers; |
|
int get comments => _comments; |
|
String get authorName => _authorName; |
|
String get authorHeadImg => _authorHeadImg; |
|
dynamic get storeName => _storeName; |
|
|
|
set id(String value) { |
|
_id = value; |
|
} |
|
|
|
set likes(int value) { |
|
_likes = value; |
|
} |
|
|
|
set liked(bool value) { |
|
_liked = value; |
|
} |
|
|
|
set viewers(int value) { |
|
_viewers = value; |
|
} |
|
|
|
set comments(int value) { |
|
_comments = value; |
|
} |
|
|
|
set authorName(String value) { |
|
_authorName = value; |
|
} |
|
|
|
set authorHeadImg(String value) { |
|
_authorHeadImg = value; |
|
} |
|
|
|
Article({ |
|
String id, |
|
String createTime, |
|
dynamic createUser, |
|
String updateTime, |
|
dynamic updateUser, |
|
String storeId, |
|
String mainTitle, |
|
dynamic viceTitle, |
|
String content, |
|
String coverImg, |
|
Author author, |
|
int type, |
|
String startTime, |
|
String endTime, |
|
int state, |
|
int isDelete, |
|
int likes, |
|
bool isHot, |
|
int viewers, |
|
int comments, |
|
String authorName, |
|
String authorHeadImg, |
|
|
|
dynamic storeName}){ |
|
_id = id; |
|
_createTime = createTime; |
|
_createUser = createUser; |
|
_updateTime = updateTime; |
|
_updateUser = updateUser; |
|
_storeId = storeId; |
|
_mainTitle = mainTitle; |
|
_viceTitle = viceTitle; |
|
_content = content; |
|
_coverImg = coverImg; |
|
_author = author; |
|
_type = type; |
|
_startTime = startTime; |
|
_categoryId = categoryId; |
|
_endTime = endTime; |
|
_state = state; |
|
_isDelete = isDelete; |
|
_likes = likes; |
|
_isHot = isHot; |
|
_liked = liked; |
|
_viewers = viewers; |
|
_comments = comments; |
|
_authorName = authorName; |
|
_authorHeadImg = authorHeadImg; |
|
_storeName = storeName; |
|
} |
|
|
|
Article.fromJson(dynamic json) { |
|
_id = json["id"]; |
|
_createTime = json["createTime"]; |
|
_createUser = json["createUser"]; |
|
_updateTime = json["updateTime"]; |
|
_updateUser = json["updateUser"]; |
|
_storeId = json["storeId"]; |
|
_mainTitle = json["mainTitle"]; |
|
_viceTitle = json["viceTitle"]; |
|
_content = json["content"]; |
|
_coverImg = json["coverImg"]; |
|
_author = json["author"] == null ? null : json["author"].toString().startsWith("{") ? Author.fromJson(jsonDecode(json["author"])):null; |
|
_type = json["type"]; |
|
_startTime = json["startTime"]; |
|
_categoryId = json["categoryId"]; |
|
_endTime = json["endTime"]; |
|
_state = json["state"]; |
|
_isDelete = json["isDelete"]; |
|
_likes = json["likes"]; |
|
_isHot = json["isHot"]; |
|
_liked = json["liked"]; |
|
_viewers = json["viewers"]; |
|
_comments = json["comments"]; |
|
_authorName = json["authorName"]; |
|
_authorHeadImg = json["authorHeadImg"]; |
|
_storeName = json["storeName"]; |
|
} |
|
|
|
Map<String, dynamic> toJson() { |
|
var map = <String, dynamic>{}; |
|
map["id"] = _id; |
|
map["createTime"] = _createTime; |
|
map["createUser"] = _createUser; |
|
map["updateTime"] = _updateTime; |
|
map["updateUser"] = _updateUser; |
|
map["storeId"] = _storeId; |
|
map["mainTitle"] = _mainTitle; |
|
map["viceTitle"] = _viceTitle; |
|
map["content"] = _content; |
|
map["coverImg"] = _coverImg; |
|
map["author"] = _author.toJson(); |
|
map["type"] = _type; |
|
map["startTime"] = _startTime; |
|
map["categoryId"] = _categoryId; |
|
map["endTime"] = _endTime; |
|
map["state"] = _state; |
|
map["isDelete"] = _isDelete; |
|
map["likes"] = _likes; |
|
map["isHot"] = _isHot; |
|
map["liked"] = _liked; |
|
map["viewers"] = _viewers; |
|
map["comments"] = _comments; |
|
map["authorName"] = _authorName; |
|
map["authorHeadImg"] = _authorHeadImg; |
|
map["storeName"] = _storeName; |
|
return map; |
|
} |
|
|
|
set createTime(String value) { |
|
_createTime = value; |
|
} |
|
|
|
set createUser(dynamic value) { |
|
_createUser = value; |
|
} |
|
|
|
set updateTime(String value) { |
|
_updateTime = value; |
|
} |
|
|
|
set updateUser(dynamic value) { |
|
_updateUser = value; |
|
} |
|
|
|
set storeId(String value) { |
|
_storeId = value; |
|
} |
|
|
|
set mainTitle(String value) { |
|
_mainTitle = value; |
|
} |
|
|
|
set viceTitle(dynamic value) { |
|
_viceTitle = value; |
|
} |
|
|
|
set content(String value) { |
|
_content = value; |
|
} |
|
|
|
set coverImg(String value) { |
|
_coverImg = value; |
|
} |
|
|
|
set author(dynamic value) { |
|
_author = value; |
|
} |
|
|
|
set type(int value) { |
|
_type = value; |
|
} |
|
|
|
set startTime(String value) { |
|
_startTime = value; |
|
} |
|
|
|
set categoryId(String value) { |
|
_categoryId = value; |
|
} |
|
|
|
set endTime(String value) { |
|
_endTime = value; |
|
} |
|
|
|
set state(int value) { |
|
_state = value; |
|
} |
|
|
|
set isDelete(int value) { |
|
_isDelete = value; |
|
} |
|
|
|
set isHot(bool value) { |
|
_isHot = value; |
|
} |
|
|
|
set storeName(dynamic value) { |
|
_storeName = value; |
|
} |
|
} |