opt models

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-06-04 15:20:35 +08:00
parent f50b1d2beb
commit b960359a39
858 changed files with 11000 additions and 12588 deletions

View File

@@ -402,86 +402,3 @@ class Code {
lang = json['lang'];
}
}
// class ArticleContentModel {
// ArticleContentModel({
// this.attributes,
// this.insert,
// });
// Attributes? attributes;
// dynamic insert;
// ArticleContentModel.fromJson(Map<String, dynamic> json) {
// attributes = json['attributes'] == null
// ? null
// : Attributes.fromJson(json['attributes']);
// insert = json['insert'] == null
// ? null
// : json['attributes']?['class'] == 'normal-img'
// ? Insert.fromJson(json['insert'])
// : json['insert'];
// }
// }
// class Insert {
// Insert({
// this.nativeImage,
// });
// NativeImage? nativeImage;
// Insert.fromJson(Map<String, dynamic> json) {
// nativeImage = json['native-image'] == null
// ? null
// : NativeImage.fromJson(json['native-image']);
// }
// }
// class NativeImage {
// NativeImage({
// this.alt,
// this.url,
// this.width,
// this.height,
// this.size,
// this.status,
// });
// dynamic alt;
// dynamic url;
// dynamic width;
// dynamic height;
// dynamic size;
// dynamic status;
// NativeImage.fromJson(Map<String, dynamic> json) {
// alt = json['alt'];
// url = json['url'];
// width = json['width'];
// height = json['height'];
// size = json['size'];
// status = json['status'];
// }
// }
// class Attributes {
// Attributes({
// this.clazz,
// this.bold,
// this.color,
// this.italic,
// this.strike,
// });
// String? clazz;
// bool? bold;
// String? color;
// bool? italic;
// bool? strike;
// Attributes.fromJson(Map<String, dynamic> json) {
// clazz = json['class'];
// bold = json['bold'];
// color = json['color'];
// italic = json['italic'];
// strike = json['strike'];
// }
// }

View File

@@ -1,31 +0,0 @@
import 'package:PiliPlus/models/dynamics/article_list/list.dart';
import 'package:PiliPlus/models/model_owner.dart';
import 'package:PiliPlus/models/space_article/item.dart';
class ArticleListData {
ArticleList? list;
List<SpaceArticleItem>? articles;
Owner? author;
bool? attention;
ArticleListData({
this.list,
this.articles,
this.author,
this.attention,
});
factory ArticleListData.fromJson(Map<String, dynamic> json) =>
ArticleListData(
list: json['list'] == null
? null
: ArticleList.fromJson(json['list'] as Map<String, dynamic>),
articles: (json['articles'] as List<dynamic>?)
?.map((e) => SpaceArticleItem.fromJson(e as Map<String, dynamic>))
.toList(),
author: json['author'] == null
? null
: Owner.fromJson(json['author'] as Map<String, dynamic>),
attention: json['attention'] as bool?,
);
}

View File

@@ -1,71 +0,0 @@
class ArticleList {
int? id;
int? mid;
String? name;
String? imageUrl;
int? updateTime;
int? ctime;
int? publishTime;
String? summary;
int? words;
int? read;
int? articlesCount;
int? state;
String? reason;
String? applyTime;
String? checkTime;
ArticleList({
this.id,
this.mid,
this.name,
this.imageUrl,
this.updateTime,
this.ctime,
this.publishTime,
this.summary,
this.words,
this.read,
this.articlesCount,
this.state,
this.reason,
this.applyTime,
this.checkTime,
});
factory ArticleList.fromJson(Map<String, dynamic> json) => ArticleList(
id: json['id'] as int?,
mid: json['mid'] as int?,
name: json['name'] as String?,
imageUrl: json['image_url'] as String?,
updateTime: json['update_time'] as int?,
ctime: json['ctime'] as int?,
publishTime: json['publish_time'] as int?,
summary: json['summary'] as String?,
words: json['words'] as int?,
read: json['read'] as int?,
articlesCount: json['articles_count'] as int?,
state: json['state'] as int?,
reason: json['reason'] as String?,
applyTime: json['apply_time'] as String?,
checkTime: json['check_time'] as String?,
);
Map<String, dynamic> toJson() => {
'id': id,
'mid': mid,
'name': name,
'image_url': imageUrl,
'update_time': updateTime,
'ctime': ctime,
'publish_time': publishTime,
'summary': summary,
'words': words,
'read': read,
'articles_count': articlesCount,
'state': state,
'reason': reason,
'apply_time': applyTime,
'check_time': checkTime,
};
}

View File

@@ -1,9 +0,0 @@
class Attributes {
String? clazz;
Attributes({this.clazz});
factory Attributes.fromJson(Map<String, dynamic> json) => Attributes(
clazz: json['class'] as String?,
);
}

View File

@@ -1,92 +0,0 @@
import 'package:PiliPlus/models/dynamics/article_opus/attributes.dart';
class ReadOpusModel {
dynamic insert;
Attributes? attributes;
ReadOpusModel({this.insert, this.attributes});
ReadOpusModel.fromJson(Map<String, dynamic> json) {
if (json['insert'] is Map) {
insert = Insert.fromJson(json['insert']);
} else {
insert = json['insert'];
}
attributes = json['attributes'] == null
? null
: Attributes.fromJson(json['attributes'] as Map<String, dynamic>);
}
}
class Insert {
InsertCard? card;
Insert({
this.card,
});
Insert.fromJson(Map<String, dynamic> json) {
if (json['article-card'] != null) {
card = InsertCard.fromJson(json['article-card']);
return;
}
if (json['live-card'] != null) {
card = InsertCard.fromJson(json['live-card']);
return;
}
if (json['goods-card'] != null) {
card = InsertCard.fromJson(json['goods-card']);
return;
}
if (json['video-card'] != null) {
card = InsertCard.fromJson(json['video-card']);
return;
}
if (json['mall-card'] != null) {
card = InsertCard.fromJson(json['mall-card']);
return;
}
if (json['vote-card'] != null) {
card = InsertCard.fromJson(json['vote-card']);
return;
}
}
}
class InsertCard {
dynamic tid;
String? id;
dynamic alt;
String? url;
num? width;
num? height;
num? size;
String? status;
InsertCard({
this.tid,
this.id,
this.alt,
this.url,
this.width,
this.height,
this.size,
this.status,
});
InsertCard.fromJson(Map<String, dynamic> json) {
tid = json['tid'];
id = json['id'] == '' ? null : json['id'];
alt = json['alt'];
url = json['url'];
width = json['width'];
height = json['height'];
size = json['size'];
status = json['status'];
}
}

View File

@@ -1,31 +0,0 @@
class DynReserveData {
int? finalBtnStatus;
int? btnMode;
int? reserveUpdate;
String? descUpdate;
String? toast;
DynReserveData({
this.finalBtnStatus,
this.btnMode,
this.reserveUpdate,
this.descUpdate,
this.toast,
});
factory DynReserveData.fromJson(Map<String, dynamic> json) => DynReserveData(
finalBtnStatus: json['final_btn_status'] as int?,
btnMode: json['btn_mode'] as int?,
reserveUpdate: json['reserve_update'] as int?,
descUpdate: json['desc_update'] as String?,
toast: json['toast'] as String?,
);
Map<String, dynamic> toJson() => {
'final_btn_status': finalBtnStatus,
'btn_mode': btnMode,
'reserve_update': reserveUpdate,
'desc_update': descUpdate,
'toast': toast,
};
}

View File

@@ -1,16 +0,0 @@
class AllSortBy {
int? sortBy;
String? sortName;
AllSortBy({this.sortBy, this.sortName});
factory AllSortBy.fromJson(Map<String, dynamic> json) => AllSortBy(
sortBy: json['sort_by'] as int?,
sortName: json['sort_name'] as String?,
);
Map<String, dynamic> toJson() => {
'sort_by': sortBy,
'sort_name': sortName,
};
}

View File

@@ -1,16 +0,0 @@
import 'package:PiliPlus/models/dynamics/result.dart';
class TopicCardItem {
DynamicItemModel? dynamicCardItem;
String? topicType;
TopicCardItem({this.dynamicCardItem, this.topicType});
factory TopicCardItem.fromJson(Map<String, dynamic> json) => TopicCardItem(
dynamicCardItem: json['dynamic_card_item'] == null
? null
: DynamicItemModel.fromJson(
json['dynamic_card_item'] as Map<String, dynamic>),
topicType: json['topic_type'] as String?,
);
}

View File

@@ -1,28 +0,0 @@
import 'package:PiliPlus/models/dynamics/dyn_topic_feed/item.dart';
import 'package:PiliPlus/models/dynamics/dyn_topic_feed/topic_sort_by_conf.dart';
class TopicCardList {
bool? hasMore;
List<TopicCardItem>? items;
String? offset;
TopicSortByConf? topicSortByConf;
TopicCardList({
this.hasMore,
this.items,
this.offset,
this.topicSortByConf,
});
factory TopicCardList.fromJson(Map<String, dynamic> json) => TopicCardList(
hasMore: json['has_more'] as bool?,
items: (json['items'] as List<dynamic>?)
?.map((e) => TopicCardItem.fromJson(e as Map<String, dynamic>))
.toList(),
offset: json['offset'] as String?,
topicSortByConf: json['topic_sort_by_conf'] == null
? null
: TopicSortByConf.fromJson(
json['topic_sort_by_conf'] as Map<String, dynamic>),
);
}

View File

@@ -1,25 +0,0 @@
import 'package:PiliPlus/models/dynamics/dyn_topic_feed/all_sort_by.dart';
class TopicSortByConf {
List<AllSortBy>? allSortBy;
int? defaultSortBy;
int? showSortBy;
TopicSortByConf({this.allSortBy, this.defaultSortBy, this.showSortBy});
factory TopicSortByConf.fromJson(Map<String, dynamic> json) {
return TopicSortByConf(
allSortBy: (json['all_sort_by'] as List<dynamic>?)
?.map((e) => AllSortBy.fromJson(e as Map<String, dynamic>))
.toList(),
defaultSortBy: json['default_sort_by'] as int?,
showSortBy: json['show_sort_by'] as int?,
);
}
Map<String, dynamic> toJson() => {
'all_sort_by': allSortBy?.map((e) => e.toJson()).toList(),
'default_sort_by': defaultSortBy,
'show_sort_by': showSortBy,
};
}

View File

@@ -1,39 +0,0 @@
import 'package:PiliPlus/models/dynamics/dyn_topic_top/topic_creator.dart';
import 'package:PiliPlus/models/dynamics/dyn_topic_top/topic_item.dart';
class TopDetails {
TopicItem? topicItem;
TopicCreator? topicCreator;
bool? hasCreateJurisdiction;
int? wordColor;
bool? closePubLayerEntry;
TopDetails({
this.topicItem,
this.topicCreator,
this.hasCreateJurisdiction,
this.wordColor,
this.closePubLayerEntry,
});
factory TopDetails.fromJson(Map<String, dynamic> json) => TopDetails(
topicItem: json['topic_item'] == null
? null
: TopicItem.fromJson(json['topic_item'] as Map<String, dynamic>),
topicCreator: json['topic_creator'] == null
? null
: TopicCreator.fromJson(
json['topic_creator'] as Map<String, dynamic>),
hasCreateJurisdiction: json['has_create_jurisdiction'] as bool?,
wordColor: json['word_color'] as int?,
closePubLayerEntry: json['close_pub_layer_entry'] as bool?,
);
Map<String, dynamic> toJson() => {
'topic_item': topicItem?.toJson(),
'topic_creator': topicCreator?.toJson(),
'has_create_jurisdiction': hasCreateJurisdiction,
'word_color': wordColor,
'close_pub_layer_entry': closePubLayerEntry,
};
}

View File

@@ -1,23 +0,0 @@
class TopicCreator {
int? uid;
String? face;
String? name;
TopicCreator({
this.uid,
this.face,
this.name,
});
factory TopicCreator.fromJson(Map<String, dynamic> json) => TopicCreator(
uid: json['uid'] as int?,
face: json['face'] as String?,
name: json['name'] as String?,
);
Map<String, dynamic> toJson() => {
'uid': uid,
'face': face,
'name': name,
};
}

View File

@@ -1,72 +0,0 @@
class TopicItem {
int? id;
String? name;
int? view;
int? discuss;
late int fav;
late int like;
int? dynamics;
String? jumpUrl;
String? backColor;
String? description;
String? sharePic;
String? shareUrl;
int? ctime;
bool? showInteractData;
bool? isFav;
bool? isLike;
TopicItem({
this.id,
this.name,
this.view,
this.discuss,
required this.fav,
required this.like,
this.dynamics,
this.jumpUrl,
this.backColor,
this.description,
this.sharePic,
this.shareUrl,
this.ctime,
this.showInteractData,
this.isFav,
this.isLike,
});
factory TopicItem.fromJson(Map<String, dynamic> json) => TopicItem(
id: json['id'] as int?,
name: json['name'] as String?,
view: json['view'] as int? ?? 0,
discuss: json['discuss'] as int? ?? 0,
fav: json['fav'] as int? ?? 0,
like: json['like'] as int? ?? 0,
dynamics: json['dynamics'] as int?,
jumpUrl: json['jump_url'] as String?,
backColor: json['back_color'] as String?,
description: json['description'] as String?,
sharePic: json['share_pic'] as String?,
shareUrl: json['share_url'] as String?,
ctime: json['ctime'] as int?,
showInteractData: json['show_interact_data'] as bool?,
isFav: json['is_fav'] as bool?,
isLike: json['is_like'] as bool?,
);
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'view': view,
'discuss': discuss,
'fav': fav,
'dynamics': dynamics,
'jump_url': jumpUrl,
'back_color': backColor,
'description': description,
'share_pic': sharePic,
'share_url': shareUrl,
'ctime': ctime,
'show_interact_data': showInteractData,
};
}

View File

@@ -3,6 +3,7 @@ import 'dart:convert';
import 'package:PiliPlus/common/widgets/pendant_avatar.dart';
import 'package:PiliPlus/models/dynamics/article_content_model.dart';
import 'package:PiliPlus/models/model_avatar.dart';
import 'package:PiliPlus/models_new/live/live_feed_index/watched_show.dart';
class DynamicsDataModel {
bool? hasMore;
@@ -55,7 +56,7 @@ class DynamicItemModel {
modules = json['item']?['modules'] == null
? ItemModulesModel()
: ItemModulesModel.fromOpusJson(
(json['item']?['modules'] as List).cast());
(json['item']['modules'] as List).cast());
if (json['fallback'] != null) {
fallback = Fallback.fromJson(json['fallback']);
@@ -1071,27 +1072,6 @@ class LivePlayInfo {
);
}
class WatchedShow {
bool? watchedShowSwitch;
int? num;
String? textSmall;
String? textLarge;
WatchedShow({
this.watchedShowSwitch,
this.num,
this.textSmall,
this.textLarge,
});
factory WatchedShow.fromJson(Map<String, dynamic> json) => WatchedShow(
watchedShowSwitch: json["switch"],
num: json["num"],
textSmall: json["text_small"],
textLarge: json["text_large"],
);
}
class DynamicTopicModel {
DynamicTopicModel({
this.id,
@@ -1443,9 +1423,11 @@ class ModuleStatModel {
// DynamicStat? coin;
ModuleStatModel.fromJson(Map<String, dynamic> json) {
comment = DynamicStat.fromJson(json['comment']);
forward = DynamicStat.fromJson(json['forward']);
like = DynamicStat.fromJson(json['like']);
comment =
json['comment'] == null ? null : DynamicStat.fromJson(json['comment']);
forward =
json['forward'] == null ? null : DynamicStat.fromJson(json['forward']);
like = json['like'] == null ? null : DynamicStat.fromJson(json['like']);
if (json['favorite'] != null) {
favorite = DynamicStat.fromJson(json['favorite']);
}

View File

@@ -37,7 +37,7 @@ class VoteInfo extends SimpleVoteInfo {
myVotes = (json['my_votes'] as List?)?.cast(); // doVote
options =
(json['options'] as List?)?.map((v) => Option.fromJson(v)).toList() ??
[];
<Option>[];
optionsCnt = json['options_cnt'];
voterLevel = json['voter_level'];
face = json['face'];