xhs_get_comments 增加 sort + max_count 控制,评论随详情一起返回
- Comment 新增 subCommentCount,新增 CommentsResult 接口 - GetFeedCommentsSchema 替换 load_all 为 sort (default/newest/most_liked) + max_count (1-100) - getFeedDetail 不再清空评论,从 Vue store 异步提取首屏评论(轮询 firstRequestFinish) - getFeedComments 重写:支持排序切换、按 maxCount 加载、返回 hasMore/totalCount - 前端详情加载后直接显示评论,无需单独请求;底部显示"加载更多评论"按钮 - CommentTree 显示"还有 X 条回复"提示 - 修复 formatTime 对空字符串和无效日期的处理
This commit is contained in:
@@ -4,6 +4,7 @@ import type {
|
||||
QRCodeResult,
|
||||
Feed,
|
||||
FeedDetail,
|
||||
CommentsResult,
|
||||
UserProfile,
|
||||
SearchFilters,
|
||||
HealthResponse,
|
||||
@@ -40,10 +41,21 @@ export const searchFeeds = (keyword: string, filters?: SearchFilters) =>
|
||||
body: JSON.stringify({ keyword, filters }),
|
||||
});
|
||||
|
||||
export const getFeedDetail = (feedId: string, xsecToken: string, loadAllComments = false) =>
|
||||
export const getFeedDetail = (feedId: string, xsecToken: string) =>
|
||||
apiFetch<ApiResponse<FeedDetail>>('/api/xhs/feeds/detail', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ feed_id: feedId, xsec_token: xsecToken, load_all_comments: loadAllComments }),
|
||||
body: JSON.stringify({ feed_id: feedId, xsec_token: xsecToken }),
|
||||
});
|
||||
|
||||
export const getFeedComments = (
|
||||
feedId: string,
|
||||
xsecToken: string,
|
||||
sort: 'default' | 'newest' | 'most_liked' = 'default',
|
||||
maxCount = 20,
|
||||
) =>
|
||||
apiFetch<ApiResponse<CommentsResult>>('/api/xhs/feeds/comments', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ feed_id: feedId, xsec_token: xsecToken, sort, max_count: maxCount }),
|
||||
});
|
||||
|
||||
// User
|
||||
|
||||
Reference in New Issue
Block a user