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.
158 lines
3.8 KiB
158 lines
3.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; |
|
Author _author; |
|
int _type; |
|
String _startTime; |
|
String _endTime; |
|
int _state; |
|
int _isDelete; |
|
int _likes; |
|
bool _isHot; |
|
bool _liked; |
|
int _viewers; |
|
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; |
|
Author get author => _author; |
|
int get type => _type; |
|
String get startTime => _startTime; |
|
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; |
|
dynamic get storeName => _storeName; |
|
|
|
set likes(int value) { |
|
_likes = value; |
|
} |
|
|
|
set liked(bool value) { |
|
_liked = value; |
|
} |
|
|
|
set viewers(int value) { |
|
_viewers = 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, |
|
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; |
|
_endTime = endTime; |
|
_state = state; |
|
_isDelete = isDelete; |
|
_likes = likes; |
|
_isHot = isHot; |
|
_liked = liked; |
|
_viewers = viewers; |
|
_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 : Author.fromJson(jsonDecode(json["author"])); |
|
_type = json["type"]; |
|
_startTime = json["startTime"]; |
|
_endTime = json["endTime"]; |
|
_state = json["state"]; |
|
_isDelete = json["isDelete"]; |
|
_likes = json["likes"]; |
|
_isHot = json["isHot"]; |
|
_liked = json["liked"]; |
|
_viewers = json["viewers"]; |
|
_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["endTime"] = _endTime; |
|
map["state"] = _state; |
|
map["isDelete"] = _isDelete; |
|
map["likes"] = _likes; |
|
map["isHot"] = _isHot; |
|
map["liked"] = _liked; |
|
map["viewers"] = _viewers; |
|
map["storeName"] = _storeName; |
|
return map; |
|
} |
|
|
|
} |