This commit is contained in:
lz_db
2026-10-25 11:46:44 +08:00
parent 893dfed0ed
commit 494f667719
63 changed files with 5213 additions and 239 deletions
+38
View File
@@ -8,6 +8,8 @@ class VideoItem {
this.duration = 0,
required this.author,
this.categoryId = 0,
this.sourceId = 0,
this.sourceName = '',
this.viewCount = 0,
this.likeCount = 0,
this.commentCount = 0,
@@ -19,6 +21,8 @@ class VideoItem {
this.status = -1,
this.statusText = '',
this.rejectReason = '',
this.seriesId = 0,
this.totalEpisodes = 0,
});
final int videoId;
@@ -28,6 +32,11 @@ class VideoItem {
final int duration; // 秒
final VideoAuthor author;
final int categoryId;
/// 内容来源(麻豆 / 91 ...)
final int sourceId;
final String sourceName;
final int viewCount;
final int likeCount;
final int commentCount;
@@ -42,6 +51,12 @@ class VideoItem {
final String statusText;
final String rejectReason;
/// 所属系列 id(0 = 非系列视频);系列聚合 Feed 中为首集 video_id
final int seriesId;
/// 系列总集数(系列聚合 Feed 返回,用于卡片「全N集」角标)
final int totalEpisodes;
/// 拷贝更新(点赞/收藏乐观更新用)
VideoItem copyWith({
bool? isLiked,
@@ -58,6 +73,8 @@ class VideoItem {
duration: duration,
author: author,
categoryId: categoryId,
sourceId: sourceId,
sourceName: sourceName,
viewCount: viewCount,
likeCount: likeCount ?? this.likeCount,
commentCount: commentCount ?? this.commentCount,
@@ -69,6 +86,8 @@ class VideoItem {
status: status,
statusText: statusText,
rejectReason: rejectReason,
seriesId: seriesId,
totalEpisodes: totalEpisodes,
);
factory VideoItem.fromJson(Map<String, dynamic> json) => VideoItem(
@@ -78,6 +97,8 @@ class VideoItem {
videoUrl: (json['video_url'] as String?) ?? '',
duration: (json['duration'] as num?)?.toInt() ?? 0,
categoryId: (json['category_id'] as num?)?.toInt() ?? 0,
sourceId: (json['source_id'] as num?)?.toInt() ?? 0,
sourceName: (json['source_name'] as String?) ?? '',
author: VideoAuthor.fromJson(
(json['author'] as Map<String, dynamic>?) ?? const {},
),
@@ -94,6 +115,23 @@ class VideoItem {
status: (json['status'] as num?)?.toInt() ?? -1,
statusText: (json['status_text'] as String?) ?? '',
rejectReason: (json['reject_reason'] as String?) ?? '',
seriesId: (json['series_id'] as num?)?.toInt() ?? 0,
totalEpisodes: (json['total_episodes'] as num?)?.toInt() ?? 0,
);
}
/// 内容来源(片商):麻豆 / 91 ...
class VideoSource {
VideoSource({required this.sourceId, required this.name, this.code = ''});
final int sourceId;
final String name;
final String code;
factory VideoSource.fromJson(Map<String, dynamic> json) => VideoSource(
sourceId: (json['source_id'] as num?)?.toInt() ?? 0,
name: (json['name'] as String?) ?? '',
code: (json['code'] as String?) ?? '',
);
}