1
This commit is contained in:
@@ -71,14 +71,22 @@ class UploadService {
|
||||
|
||||
/// 视频分类
|
||||
class VideoCategory {
|
||||
VideoCategory({required this.categoryId, required this.name});
|
||||
VideoCategory({
|
||||
required this.categoryId,
|
||||
required this.name,
|
||||
this.hasSeries = false,
|
||||
});
|
||||
|
||||
final int categoryId;
|
||||
final String name;
|
||||
|
||||
/// 系列型分类(如 AI短剧):列表按「剧」聚合展示,一部剧只占一张卡片
|
||||
final bool hasSeries;
|
||||
|
||||
factory VideoCategory.fromJson(Map<String, dynamic> json) => VideoCategory(
|
||||
categoryId: (json['category_id'] as num?)?.toInt() ?? 0,
|
||||
name: (json['name'] as String?) ?? '',
|
||||
hasSeries: (json['has_series'] as bool?) ?? false,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,11 +8,14 @@ class VideoService {
|
||||
VideoService._();
|
||||
|
||||
/// 5.1 Feed 流:type=recommend|latest|hot,游标分页
|
||||
/// [group]=series 时(系列型分类)按「剧」聚合,一部剧只返回首集一条
|
||||
static Future<FeedPage> fetchFeed({
|
||||
String type = 'recommend',
|
||||
String? cursor,
|
||||
int limit = 10,
|
||||
int? categoryId,
|
||||
int? sourceId,
|
||||
String? group,
|
||||
}) async {
|
||||
final data = await ApiClient.get<Map<String, dynamic>>(
|
||||
Endpoints.feed,
|
||||
@@ -21,6 +24,8 @@ class VideoService {
|
||||
if (cursor != null && cursor.isNotEmpty) 'cursor': cursor,
|
||||
'limit': limit,
|
||||
if (categoryId != null) 'category_id': categoryId,
|
||||
if (sourceId != null) 'source_id': sourceId,
|
||||
if (group != null) 'group': group,
|
||||
},
|
||||
);
|
||||
final list = ((data['list'] as List?) ?? const [])
|
||||
@@ -30,6 +35,15 @@ class VideoService {
|
||||
return FeedPage(items: list, nextCursor: data['next_cursor'] as String?);
|
||||
}
|
||||
|
||||
/// 内容来源列表(麻豆 / 91 ...),分类页筛选用
|
||||
static Future<List<VideoSource>> fetchSources() async {
|
||||
final data = await ApiClient.get<Map<String, dynamic>>(Endpoints.sources);
|
||||
return ((data['list'] as List?) ?? const [])
|
||||
.whereType<Map<String, dynamic>>()
|
||||
.map(VideoSource.fromJson)
|
||||
.toList();
|
||||
}
|
||||
|
||||
/// 5.2 视频详情(登录返回续播进度 my_position)
|
||||
static Future<Map<String, dynamic>> fetchDetail(int videoId) =>
|
||||
ApiClient.get<Map<String, dynamic>>(Endpoints.videoDetail(videoId));
|
||||
@@ -93,6 +107,10 @@ class VideoService {
|
||||
static Future<void> deleteVideo(int videoId) =>
|
||||
ApiClient.delete<Map<String, dynamic>>(Endpoints.videoDelete(videoId));
|
||||
|
||||
/// 下架视频(仅站点管理员 256kb@gmail.com,App 长按菜单)
|
||||
static Future<void> offlineVideo(int videoId) =>
|
||||
ApiClient.post<Map<String, dynamic>>(Endpoints.videoOffline(videoId));
|
||||
|
||||
/// 5.9 标签视频列表(游客可):sort=hot(默认)| latest,普通分页
|
||||
static Future<TagVideosPage> fetchTagVideos(
|
||||
String tagName, {
|
||||
|
||||
Reference in New Issue
Block a user