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.

170 lines
4.4 KiB

4 years ago
import 'dart:convert';
import 'package:huixiang/retrofit/data/author.dart';
4 years ago
/// id : "4"
/// createTime : "2021-07-05 14:20:43"
/// createUser : null
/// updateTime : "2021-07-05 14:23:47"
/// updateUser : null
/// storeId : "0"
/// mainTitle : "牡丹花的养护知识"
/// viceTitle : null
/// content : "阿斯顿发斯蒂芬"
/// coverImg : "https://pos.upload.gznl.top/MDAwMA==/2021/06/2a1060d8-08f6-4036-935a-0514aaade9d8.jpg"
/// author : "{\"name\":\"百花谷\",\"avatar\":\"https://pos.upload.gznl.top/MDAwMA==/2021/06/6a3586dc-a340-470f-b645-1e3155d5f558.jpg\"}"
/// type : 2
/// startTime : "2021-07-05 14:25:10"
/// endTime : "2099-01-01 00:00:00"
/// state : 1
4 years ago
/// isDelete : 0
4 years ago
/// storeName : null
4 years ago
class Article {
String _id;
4 years ago
String _createTime;
dynamic _createUser;
String _updateTime;
dynamic _updateUser;
String _storeId;
4 years ago
String _mainTitle;
4 years ago
dynamic _viceTitle;
String _content;
String _coverImg;
Author _author;
int _type;
4 years ago
String _startTime;
4 years ago
String _endTime;
4 years ago
int _state;
4 years ago
int _isDelete;
3 years ago
int _likes;
3 years ago
bool _isHot;
3 years ago
bool _liked;
3 years ago
int _viewers;
4 years ago
dynamic _storeName;
4 years ago
String get id => _id;
4 years ago
String get createTime => _createTime;
dynamic get createUser => _createUser;
String get updateTime => _updateTime;
dynamic get updateUser => _updateUser;
String get storeId => _storeId;
4 years ago
String get mainTitle => _mainTitle;
4 years ago
dynamic get viceTitle => _viceTitle;
String get content => _content;
String get coverImg => _coverImg;
Author get author => _author;
int get type => _type;
4 years ago
String get startTime => _startTime;
4 years ago
String get endTime => _endTime;
4 years ago
int get state => _state;
4 years ago
int get isDelete => _isDelete;
3 years ago
int get likes => _likes;
3 years ago
bool get isHot => _isHot;
3 years ago
bool get liked => _liked;
3 years ago
int get viewers => _viewers;
4 years ago
dynamic get storeName => _storeName;
4 years ago
3 years ago
set likes(int value) {
_likes = value;
}
3 years ago
set viewers(int value) {
_viewers = value;
}
4 years ago
Article({
4 years ago
String id,
4 years ago
String createTime,
4 years ago
dynamic createUser,
String updateTime,
dynamic updateUser,
String storeId,
4 years ago
String mainTitle,
4 years ago
dynamic viceTitle,
String content,
String coverImg,
Author author,
4 years ago
int type,
4 years ago
String startTime,
String endTime,
int state,
int isDelete,
3 years ago
int likes,
3 years ago
bool isHot,
3 years ago
int viewers,
4 years ago
dynamic storeName}){
_id = id;
4 years ago
_createTime = createTime;
_createUser = createUser;
4 years ago
_updateTime = updateTime;
_updateUser = updateUser;
_storeId = storeId;
4 years ago
_mainTitle = mainTitle;
4 years ago
_viceTitle = viceTitle;
_content = content;
_coverImg = coverImg;
_author = author;
_type = type;
4 years ago
_startTime = startTime;
4 years ago
_endTime = endTime;
4 years ago
_state = state;
4 years ago
_isDelete = isDelete;
3 years ago
_likes = likes;
3 years ago
_isHot = isHot;
3 years ago
_liked = liked;
3 years ago
_viewers = viewers;
4 years ago
_storeName = storeName;
}
Article.fromJson(dynamic json) {
4 years ago
_id = json["id"];
4 years ago
_createTime = json["createTime"];
_createUser = json["createUser"];
4 years ago
_updateTime = json["updateTime"];
_updateUser = json["updateUser"];
_storeId = json["storeId"];
4 years ago
_mainTitle = json["mainTitle"];
4 years ago
_viceTitle = json["viceTitle"];
_content = json["content"];
_coverImg = json["coverImg"];
3 years ago
_author = json["author"] == null ? null : Author.fromJson(jsonDecode(json["author"]));
4 years ago
_type = json["type"];
4 years ago
_startTime = json["startTime"];
4 years ago
_endTime = json["endTime"];
4 years ago
_state = json["state"];
4 years ago
_isDelete = json["isDelete"];
3 years ago
_likes = json["likes"];
3 years ago
_isHot = json["isHot"];
3 years ago
_liked = json["liked"];
3 years ago
_viewers = json["viewers"];
4 years ago
_storeName = json["storeName"];
}
Map<String, dynamic> toJson() {
var map = <String, dynamic>{};
4 years ago
map["id"] = _id;
4 years ago
map["createTime"] = _createTime;
map["createUser"] = _createUser;
4 years ago
map["updateTime"] = _updateTime;
map["updateUser"] = _updateUser;
map["storeId"] = _storeId;
4 years ago
map["mainTitle"] = _mainTitle;
4 years ago
map["viceTitle"] = _viceTitle;
map["content"] = _content;
map["coverImg"] = _coverImg;
map["author"] = _author.toJson();
map["type"] = _type;
4 years ago
map["startTime"] = _startTime;
4 years ago
map["endTime"] = _endTime;
4 years ago
map["state"] = _state;
4 years ago
map["isDelete"] = _isDelete;
3 years ago
map["likes"] = _likes;
3 years ago
map["isHot"] = _isHot;
3 years ago
map["liked"] = _liked;
3 years ago
map["viewers"] = _viewers;
4 years ago
map["storeName"] = _storeName;
return map;
}
}