clean up models

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-04-05 12:10:18 +08:00
parent b897103af0
commit 279f21857d
308 changed files with 156 additions and 6243 deletions

View File

@@ -1,13 +0,0 @@
class Badge {
String? text;
int? bgStyle;
String? img;
Badge({this.text, this.bgStyle, this.img});
factory Badge.fromJson(Map<String, dynamic> json) => Badge(
text: json['text'] as String?,
bgStyle: json['bg_style'] as int?,
img: json['img'] as String?,
);
}

View File

@@ -1,11 +0,0 @@
class Coin {
num? maxNum;
num? coinNumber;
Coin({this.maxNum, this.coinNumber});
factory Coin.fromJson(Map<String, dynamic> json) => Coin(
maxNum: json['max_num'] as num?,
coinNumber: json['coin_number'] as num?,
);
}

View File

@@ -2,15 +2,9 @@ import 'package:PiliPlus/models_new/media_list/media_list.dart';
class MediaListData {
List<MediaListItemModel> mediaList;
bool? hasMore;
int? totalCount;
String? nextStartKey;
MediaListData({
required this.mediaList,
this.hasMore,
this.totalCount,
this.nextStartKey,
});
factory MediaListData.fromJson(Map<String, dynamic> json) => MediaListData(
@@ -19,8 +13,5 @@ class MediaListData {
?.map((e) => MediaListItemModel.fromJson(e as Map<String, dynamic>))
.toList() ??
<MediaListItemModel>[],
hasMore: json['has_more'] as bool?,
totalCount: json['total_count'] as int?,
nextStartKey: json['next_start_key'] as String?,
);
}

View File

@@ -1,110 +1,48 @@
import 'package:PiliPlus/models/model_owner.dart';
import 'package:PiliPlus/models_new/fav/fav_detail/cnt_info.dart';
import 'package:PiliPlus/models_new/media_list/coin.dart';
import 'package:PiliPlus/models_new/media_list/ogv_info.dart';
import 'package:PiliPlus/models_new/media_list/page.dart';
import 'package:PiliPlus/models_new/media_list/rights.dart';
import 'package:PiliPlus/models_new/video/video_detail/episode.dart';
class MediaListItemModel extends BaseEpisodeItem {
@override
int? get id => aid;
int? offset;
int? index;
String? intro;
int? attr;
int? tid;
int? copyRight;
CntInfo? cntInfo;
int? duration;
int? pubtime;
int? likeState;
int? favState;
int? page;
List<Page>? pages;
int? type;
Owner? upper;
String? link;
String? shortLink;
Rights? rights;
dynamic elecInfo;
Coin? coin;
OgvInfo? ogvInfo;
double? progressPercent;
bool? forbidFav;
int? moreType;
int? businessOid;
@override
int? get cid => pages?.firstOrNull?.id;
MediaListItemModel({
super.aid,
this.offset,
this.index,
this.intro,
this.attr,
this.tid,
this.copyRight,
this.cntInfo,
super.cover,
this.duration,
this.pubtime,
this.likeState,
this.favState,
this.page,
this.pages,
super.title,
this.type,
this.upper,
this.link,
super.bvid,
this.shortLink,
this.rights,
this.elecInfo,
this.coin,
this.ogvInfo,
this.progressPercent,
super.badge,
this.forbidFav,
this.moreType,
this.businessOid,
super.cid,
});
MediaListItemModel.fromJson(Map<String, dynamic> json) {
aid = json['id'] as int?;
offset = json['offset'] as int?;
index = json['index'] as int?;
intro = json['intro'] as String?;
attr = json['attr'] as int?;
tid = json['tid'] as int?;
copyRight = json['copy_right'] as int?;
cntInfo = json['cnt_info'] == null
? null
: CntInfo.fromJson(json['cnt_info']);
cover = json['cover'] as String?;
duration = json['duration'] as int?;
pubtime = json['pubtime'] as int?;
likeState = json['like_state'] as int?;
favState = json['fav_state'] as int?;
page = json['page'] as int?;
pages = (json['pages'] as List?)?.map((e) => Page.fromJson(e)).toList();
title = json['title'] as String?;
type = json['type'] as int?;
upper = json['upper'] == null ? null : Owner.fromJson(json['upper']);
link = json['link'] as String?;
bvid = json['bv_id'] as String?;
shortLink = json['short_link'] as String?;
rights = json['rights'] == null ? null : Rights.fromJson(json['rights']);
elecInfo = json['elec_info'] as dynamic;
coin = json['coin'] == null ? null : Coin.fromJson(json['coin']);
ogvInfo = json['ogv_info'] == null
? null
: OgvInfo.fromJson(json['ogv_info']);
progressPercent = (json['progress_percent'] as num?)?.toDouble();
badge = json['badge']?['text'];
forbidFav = json['forbid_fav'] as bool?;
moreType = json['more_type'] as int?;
businessOid = json['business_oid'] as int?;
}
}

View File

@@ -1,21 +0,0 @@
import 'package:PiliPlus/models_new/video/video_detail/dimension.dart';
class OgvInfo {
int? epid;
int? seasonId;
int? aid;
int? cid;
Dimension? dimension;
OgvInfo({this.epid, this.seasonId, this.aid, this.cid, this.dimension});
factory OgvInfo.fromJson(Map<String, dynamic> json) => OgvInfo(
epid: json['epid'] as int?,
seasonId: json['season_id'] as int?,
aid: json['aid'] as int?,
cid: json['cid'] as int?,
dimension: json['dimension'] == null
? null
: Dimension.fromJson(json['dimension'] as Map<String, dynamic>),
);
}

View File

@@ -1,36 +1,11 @@
import 'package:PiliPlus/models_new/video/video_detail/dimension.dart';
class Page {
int? id;
String? title;
String? intro;
int? duration;
String? link;
int? page;
String? from;
Dimension? dimension;
Page({
this.id,
this.title,
this.intro,
this.duration,
this.link,
this.page,
this.from,
this.dimension,
});
factory Page.fromJson(Map<String, dynamic> json) => Page(
id: json["id"],
title: json["title"],
intro: json["intro"],
duration: json["duration"],
link: json["link"],
page: json["page"],
from: json["from"],
dimension: json["dimension"] == null
? null
: Dimension.fromJson(json["dimension"]),
);
}

View File

@@ -1,38 +0,0 @@
class Rights {
int? bp;
int? elec;
int? download;
int? movie;
int? pay;
int? ugcPay;
int? hd5;
int? noReprint;
int? autoplay;
int? noBackground;
Rights({
this.bp,
this.elec,
this.download,
this.movie,
this.pay,
this.ugcPay,
this.hd5,
this.noReprint,
this.autoplay,
this.noBackground,
});
factory Rights.fromJson(Map<String, dynamic> json) => Rights(
bp: json['bp'] as int?,
elec: json['elec'] as int?,
download: json['download'] as int?,
movie: json['movie'] as int?,
pay: json['pay'] as int?,
ugcPay: json['ugc_pay'] as int?,
hd5: json['hd5'] as int?,
noReprint: json['no_reprint'] as int?,
autoplay: json['autoplay'] as int?,
noBackground: json['no_background'] as int?,
);
}