fix(player): 收藏与评论数实时刷新

This commit is contained in:
Zhou Weidong committed 2026-10-21 11:39:58 +08:00
1 parent 97bbced02c
commit 5e2b8d9e4d
11 files changed
+275 -29

No files matched your search

+10
View File
@@ -1,6 +1,7 @@
// Author: fruit.com.cn
import '../models/comment.dart';
import '../models/json_numbers.dart';
import 'api_client.dart';
/// 评论接口,对应契约 §1.7 的 `/app/comments*`。
@@ -29,6 +30,15 @@ class CommentApi {
return CommentPage.fromJson(data);
}
/// 查询单部剧的有效评论总数;后端 Long 兼容数字与字符串。
Future<int> count(String dramaId) async {
final data = await _client.get(
'/app/comments/count',
query: {'dramaId': dramaId},
);
return jsonToInt(data);
}
/// 发表评论或回复;回复只提交 `parentId`,不自行拼层级。
Future<DramaComment> publish({
required String dramaId,
@@ -13,6 +13,9 @@ abstract interface class CommentRepository {
int size = commentPageSize,
});
/// 查询单部剧的有效评论总数。
Future<int> count(String dramaId);
/// 发表评论或回复。
Future<DramaComment> publish({
required String dramaId,
@@ -44,6 +47,9 @@ class HttpCommentRepository implements CommentRepository {
size: size,
);
@override
Future<int> count(String dramaId) => _api.count(dramaId);
@override
Future<DramaComment> publish({
required String dramaId,