import 'dart:convert'; import 'author.dart'; /// id : "1498607093517647872" /// createTime : "2022-03-01 18:32:29" /// createUser : "1495959790726152192" /// updateTime : "2022-03-01 18:45:04" /// updateUser : "1495959790726152192" /// storeId : "0" /// categoryId : "0" /// mainTitle : "哈哈哈哈" /// viceTitle : null /// content : "{\"images\":[],\"video\":\"\",\"type\":\"text\"}" /// coverImg : "" /// author : "1495959790726152192" /// type : 3 /// likes : 0 /// viewers : 2 /// startTime : "2022-03-01 18:32:28" /// endTime : "2121-03-01 18:32:28" /// isHot : false /// state : 1 /// location : "" /// longitude : "0.000000" /// latitude : "0.000000" /// remark : "" /// isDelete : 0 /// tenantCode : "" /// storeName : null /// liked : false /// followed : false /// comments : null /// authorName : "小帽子" /// authorHeadImg : "https://pos.upload.gznl.top/admin/2022/02/5877a3fe-0d25-405b-a86b-7bac293ab048.jpeg" class Article { Article({ String id, String createTime, String createUser, String updateTime, String updateUser, String storeId, String categoryId, String mainTitle, dynamic viceTitle, String content, String coverImg, dynamic author, int type, int likes, int viewers, String startTime, String endTime, bool isHot, int state, String location, String longitude, String latitude, String remark, int isDelete, String tenantCode, dynamic storeName, bool liked, bool followed, dynamic comments, String authorName, String authorHeadImg,}){ _id = id; _createTime = createTime; _createUser = createUser; _updateTime = updateTime; _updateUser = updateUser; _storeId = storeId; _categoryId = categoryId; _mainTitle = mainTitle; _viceTitle = viceTitle; _content = content; _coverImg = coverImg; _author = author; _type = type; _likes = likes; _viewers = viewers; _startTime = startTime; _endTime = endTime; _isHot = isHot; _state = state; _location = location; _longitude = longitude; _latitude = latitude; _remark = remark; _isDelete = isDelete; _tenantCode = tenantCode; _storeName = storeName; _liked = liked; _followed = followed; _comments = comments; _authorName = authorName; _authorHeadImg = authorHeadImg; } Article.fromJson(dynamic json) { _id = json['id']; _createTime = json['createTime']; _createUser = json['createUser']; _updateTime = json['updateTime']; _updateUser = json['updateUser']; _storeId = json['storeId']; _categoryId = json['categoryId']; _mainTitle = json['mainTitle']; _viceTitle = json['viceTitle']; _content = json['content']; _coverImg = json['coverImg']; _author = json["author"] == null ? author : json["author"].toString().startsWith("{") ? Author.fromJson(jsonDecode(json["author"])):json["author"]; _type = json['type']; _likes = json['likes']; _viewers = json['viewers']; _startTime = json['startTime']; _endTime = json['endTime']; _isHot = json['isHot']; _state = json['state']; _location = json['location']; _longitude = json['longitude']; _latitude = json['latitude']; _remark = json['remark']; _isDelete = json['isDelete']; _tenantCode = json['tenantCode']; _storeName = json['storeName']; _liked = json['liked']; _followed = json['followed']; _comments = json['comments']; _authorName = json['authorName']; _authorHeadImg = json['authorHeadImg']; } String _id; String _createTime; String _createUser; String _updateTime; String _updateUser; String _storeId; String _categoryId; String _mainTitle; dynamic _viceTitle; String _content; String _coverImg; dynamic _author; int _type; int _likes; int _viewers; String _startTime; String _endTime; bool _isHot; int _state; String _location; String _longitude; String _latitude; String _remark; int _isDelete; String _tenantCode; dynamic _storeName; bool _liked; bool _followed; dynamic _comments; String _authorName; String _authorHeadImg; String get id => _id; String get createTime => _createTime; String get createUser => _createUser; String get updateTime => _updateTime; String get updateUser => _updateUser; String get storeId => _storeId; String get categoryId => _categoryId; String get mainTitle => _mainTitle; dynamic get viceTitle => _viceTitle; String get content => _content; String get coverImg => _coverImg; dynamic get author => _author; int get type => _type; int get likes => _likes; int get viewers => _viewers; String get startTime => _startTime; String get endTime => _endTime; bool get isHot => _isHot; int get state => _state; String get location => _location; String get longitude => _longitude; String get latitude => _latitude; String get remark => _remark; int get isDelete => _isDelete; String get tenantCode => _tenantCode; dynamic get storeName => _storeName; bool get liked => _liked; bool get followed => _followed; dynamic get comments => _comments; String get authorName => _authorName; String get authorHeadImg => _authorHeadImg; Map toJson() { final map = {}; map['id'] = _id; map['createTime'] = _createTime; map['createUser'] = _createUser; map['updateTime'] = _updateTime; map['updateUser'] = _updateUser; map['storeId'] = _storeId; map['categoryId'] = _categoryId; map['mainTitle'] = _mainTitle; map['viceTitle'] = _viceTitle; map['content'] = _content; map['coverImg'] = _coverImg; map["author"] = _author.toJson() ?? _author; map['type'] = _type; map['likes'] = _likes; map['viewers'] = _viewers; map['startTime'] = _startTime; map['endTime'] = _endTime; map['isHot'] = _isHot; map['state'] = _state; map['location'] = _location; map['longitude'] = _longitude; map['latitude'] = _latitude; map['remark'] = _remark; map['isDelete'] = _isDelete; map['tenantCode'] = _tenantCode; map['storeName'] = _storeName; map['liked'] = _liked; map['followed'] = _followed; map['comments'] = _comments; map['authorName'] = _authorName; map['authorHeadImg'] = _authorHeadImg; return map; } set authorHeadImg(String value) { _authorHeadImg = value; } set authorName(String value) { _authorName = value; } set comments(dynamic value) { _comments = value; } set followed(bool value) { _followed = value; } set liked(bool value) { _liked = value; } set storeName(dynamic value) { _storeName = value; } set tenantCode(String value) { _tenantCode = value; } set isDelete(int value) { _isDelete = value; } set remark(String value) { _remark = value; } set latitude(String value) { _latitude = value; } set longitude(String value) { _longitude = value; } set location(String value) { _location = value; } set state(int value) { _state = value; } set isHot(bool value) { _isHot = value; } set endTime(String value) { _endTime = value; } set startTime(String value) { _startTime = value; } set viewers(int value) { _viewers = value; } set likes(int value) { _likes = value; } set type(int value) { _type = value; } set author(dynamic value) { _author = value; } set coverImg(String value) { _coverImg = value; } set content(String value) { _content = value; } set viceTitle(dynamic value) { _viceTitle = value; } set mainTitle(String value) { _mainTitle = value; } set categoryId(String value) { _categoryId = value; } set storeId(String value) { _storeId = value; } set updateUser(String value) { _updateUser = value; } set updateTime(String value) { _updateTime = value; } set createUser(String value) { _createUser = value; } set createTime(String value) { _createTime = value; } set id(String value) { _id = value; } }