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

@@ -0,0 +1,13 @@
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

@@ -0,0 +1,41 @@
class CntInfo {
int? collect;
int? play;
int? thumbUp;
int? thumbDown;
int? share;
int? reply;
int? danmaku;
int? coin;
int? vt;
int? playSwitch;
String? viewText1;
CntInfo({
this.collect,
this.play,
this.thumbUp,
this.thumbDown,
this.share,
this.reply,
this.danmaku,
this.coin,
this.vt,
this.playSwitch,
this.viewText1,
});
factory CntInfo.fromJson(Map<String, dynamic> json) => CntInfo(
collect: json['collect'] as int?,
play: json['play'] as int?,
thumbUp: json['thumb_up'] as int?,
thumbDown: json['thumb_down'] as int?,
share: json['share'] as int?,
reply: json['reply'] as int?,
danmaku: json['danmaku'] as int?,
coin: json['coin'] as int?,
vt: json['vt'] as int?,
playSwitch: json['play_switch'] as int?,
viewText1: json['view_text_1'] as String?,
);
}

View File

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

View File

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

View File

@@ -0,0 +1,13 @@
class Dimension {
int? width;
int? height;
int? rotate;
Dimension({this.width, this.height, this.rotate});
factory Dimension.fromJson(Map<String, dynamic> json) => Dimension(
width: json['width'] as int?,
height: json['height'] as int?,
rotate: json['rotate'] as int?,
);
}

View File

@@ -0,0 +1,113 @@
import 'package:PiliPlus/models_new/media_list/badge.dart';
import 'package:PiliPlus/models_new/media_list/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/media_list/upper.dart';
import 'package:PiliPlus/utils/extension.dart';
class MediaListItemModel {
int? get id => aid;
int? aid;
int? offset;
int? index;
String? intro;
int? attr;
int? tid;
int? copyRight;
CntInfo? cntInfo;
String? cover;
int? duration;
int? pubtime;
int? likeState;
int? favState;
int? page;
List<Page>? pages;
String? title;
int? type;
Upper? upper;
String? link;
String? bvid;
String? shortLink;
Rights? rights;
dynamic elecInfo;
Coin? coin;
OgvInfo? ogvInfo;
double? progressPercent;
Badge? badge;
bool? forbidFav;
int? moreType;
int? businessOid;
int? cid;
MediaListItemModel({
this.aid,
this.offset,
this.index,
this.intro,
this.attr,
this.tid,
this.copyRight,
this.cntInfo,
this.cover,
this.duration,
this.pubtime,
this.likeState,
this.favState,
this.page,
this.pages,
this.title,
this.type,
this.upper,
this.link,
this.bvid,
this.shortLink,
this.rights,
this.elecInfo,
this.coin,
this.ogvInfo,
this.progressPercent,
this.badge,
this.forbidFav,
this.moreType,
this.businessOid,
this.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 : Upper.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'] == null ? null : Badge.fromJson(json['badge']);
forbidFav = json['forbid_fav'] as bool?;
moreType = json['more_type'] as int?;
businessOid = json['business_oid'] as int?;
cid = pages.getOrNull((page ?? 1) - 1)?.id;
}
}

View File

@@ -0,0 +1,21 @@
import 'package:PiliPlus/models_new/media_list/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

@@ -0,0 +1,36 @@
import 'package:PiliPlus/models_new/media_list/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

@@ -0,0 +1,38 @@
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?,
);
}

View File

@@ -0,0 +1,47 @@
class Upper {
int? mid;
String? name;
String? face;
int? followed;
int? fans;
int? vipType;
int? vipStatue;
int? vipDueDate;
int? vipPayType;
int? officialRole;
String? officialTitle;
String? officialDesc;
String? displayName;
Upper({
this.mid,
this.name,
this.face,
this.followed,
this.fans,
this.vipType,
this.vipStatue,
this.vipDueDate,
this.vipPayType,
this.officialRole,
this.officialTitle,
this.officialDesc,
this.displayName,
});
factory Upper.fromJson(Map<String, dynamic> json) => Upper(
mid: json['mid'] as int?,
name: json['name'] as String?,
face: json['face'] as String?,
followed: json['followed'] as int?,
fans: json['fans'] as int?,
vipType: json['vip_type'] as int?,
vipStatue: json['vip_statue'] as int?,
vipDueDate: json['vip_due_date'] as int?,
vipPayType: json['vip_pay_type'] as int?,
officialRole: json['official_role'] as int?,
officialTitle: json['official_title'] as String?,
officialDesc: json['official_desc'] as String?,
displayName: json['display_name'] as String?,
);
}