refa: video model (#523)

This commit is contained in:
My-Responsitories
2025-03-25 10:12:44 +08:00
committed by GitHub
parent bf464994df
commit 7a6085e923
52 changed files with 761 additions and 1494 deletions

View File

@@ -1,66 +1,23 @@
import './model_owner.dart';
import 'model_owner.dart';
import 'model_rec_video_item.dart';
import 'model_video.dart';
class HotVideoItemModel {
HotVideoItemModel({
this.aid,
this.cid,
this.bvid,
this.videos,
this.tid,
this.tname,
this.copyright,
this.pic,
this.title,
this.pubdate,
this.ctime,
this.desc,
this.state,
this.duration,
this.middionId,
this.owner,
this.stat,
this.vDynamic,
this.dimension,
this.shortLinkV2,
this.firstFrame,
this.pubLocation,
this.seasontype,
this.isOgv,
this.rcmdReason,
this.checked,
this.pgcLabel,
this.redirectUrl,
});
int? aid;
int? cid;
String? bvid;
// 稍后再看, 排行榜等网页返回也使用该类
class HotVideoItemModel extends BaseRecVideoItemModel {
int? videos;
int? tid;
String? tname;
int? copyright;
String? pic;
String? title;
int? pubdate;
int? ctime;
String? desc;
int? state;
int? duration;
int? middionId;
Owner? owner;
Stat? stat;
String? vDynamic;
Dimension? dimension;
String? shortLinkV2;
String? firstFrame;
String? pubLocation;
int? seasontype;
bool? isOgv;
RcmdReason? rcmdReason;
bool? checked;
String? pgcLabel;
String? redirectUrl;
bool? checked; // 手动设置的
HotVideoItemModel.fromJson(Map<String, dynamic> json) {
aid = json["aid"];
cid = json["cid"];
@@ -76,97 +33,62 @@ class HotVideoItemModel {
desc = json["desc"];
state = json["state"];
duration = json["duration"];
middionId = json["middion_id"];
owner = Owner.fromJson(json["owner"]);
stat = Stat.fromJson(json['stat']);
vDynamic = json["vDynamic"];
dimension = Dimension.fromMap(json['dimension']);
shortLinkV2 = json["short_link_v2"];
stat = HotStat.fromJson(json['stat']);
dimension = Dimension.fromJson(json['dimension']);
firstFrame = json["first_frame"];
pubLocation = json["pub_location"];
seasontype = json["seasontype"];
isOgv = json["isOgv"];
rcmdReason = json['rcmd_reason'] != '' && json['rcmd_reason'] != null
? RcmdReason.fromJson(json['rcmd_reason'])
: null;
dynamic rcmd = json['rcmd_reason'];
rcmdReason = rcmd is Map ? rcmd['content'] : rcmd; // 相关视频里rcmd为String,
if (rcmdReason?.isEmpty == true) rcmdReason = null;
pgcLabel = json['pgc_label'];
redirectUrl = json['redirect_url'];
// uri = json['uri']; // 仅在稍后再看存在
}
// @override
// get isFollowed => false;
// @override
// get goto => 'av';
// @override
// get uri => 'bilibili://video/$aid';
}
class Stat {
Stat({
this.aid,
this.view,
this.danmu,
this.reply,
this.favorite,
this.coin,
this.share,
this.nowRank,
this.hisRank,
this.like,
this.dislike,
this.vt,
this.vv,
});
int? aid;
int? view;
int? danmu;
class HotStat extends Stat {
int? reply;
int? favorite;
int? coin;
int? share;
int? nowRank;
int? hisRank;
int? like;
int? dislike;
int? vt;
int? vv;
Stat.fromJson(Map<String, dynamic> json) {
aid = json["aid"];
view = json["view"];
danmu = json['danmaku'];
HotStat.fromJson(Map<String, dynamic> json) : super.fromJson(json) {
reply = json["reply"];
favorite = json["favorite"];
coin = json['coin'];
share = json["share"];
nowRank = json["now_rank"];
hisRank = json['his_rank'];
like = json["like"];
dislike = json["dislike"];
vt = json['vt'];
vv = json["vv"];
}
}
class Dimension {
Dimension({this.width, this.height, this.rotate});
// class RcmdReason {
// RcmdReason({
// this.rcornerMark,
// this.content,
// });
int? width;
int? height;
int? rotate;
// int? rcornerMark;
// String? content = '';
Dimension.fromMap(Map<String, dynamic> json) {
width = json["width"];
height = json["height"];
rotate = json["rotate"];
}
}
class RcmdReason {
RcmdReason({
this.rcornerMark,
this.content,
});
int? rcornerMark;
String? content = '';
RcmdReason.fromJson(Map<String, dynamic> json) {
rcornerMark = json["corner_mark"];
content = json["content"] ?? '';
}
}
// RcmdReason.fromJson(Map<String, dynamic> json) {
// rcornerMark = json["corner_mark"];
// content = json["content"] ?? '';
// }
// }