unify horizontal video models

Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-04-28 10:32:15 +08:00
parent 80ecd35784
commit 524b6bca1c
8 changed files with 128 additions and 129 deletions

View File

@@ -1,25 +1,19 @@
import 'package:PiliPlus/models/horizontal_video_model.dart';
import 'package:PiliPlus/models/model_owner.dart';
import 'package:PiliPlus/models/model_rec_video_item.dart';
import 'package:PiliPlus/models/model_video.dart';
import 'package:PiliPlus/models_new/video/video_detail/dimension.dart';
import 'package:PiliPlus/pages/common/multi_select/base.dart';
// 稍后再看, 排行榜等网页返回也使用该类
class HotVideoItemModel extends BaseRcmdVideoItemModel with MultiSelectData {
class HotVideoItemModel extends HorizontalVideoModel with MultiSelectData {
int? videos;
int? tid;
String? tname;
int? copyright;
int? ctime;
int? state;
Dimension? dimension;
String? firstFrame;
String? pubLocation;
String? pgcLabel;
String? redirectUrl;
num? progress;
int? isCooperation;
bool? isCharging;
HotVideoItemModel.fromJson(Map<String, dynamic> json) {
aid = json["aid"];
@@ -43,23 +37,16 @@ class HotVideoItemModel extends BaseRcmdVideoItemModel with MultiSelectData {
: Dimension.fromJson(json['dimension']);
firstFrame = json["first_frame"];
pubLocation = json["pub_location"];
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']; // 仅在稍后再看存在
progress = json['progress'];
isCooperation = json['rights']?['is_cooperation'];
isCharging = json['charging_pay']?['level'] != null;
if (json['charging_pay']?['level'] != null) {
badge = '充电专属';
} else if (json['rights']?['is_cooperation'] == 1) {
badge = '合作';
} else {
badge = json['pgc_label'];
}
}
// @override
// get isFollowed => false;
// @override
// get goto => 'av';
// @override
// get uri => 'bilibili://video/$aid';
}
class HotStat extends Stat {