支持评论级联软删与后台回收站,并完善 Markdown 代码围栏嵌套。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-06 17:49:05 +08:00
parent e6e7ed73e3
commit bb8d415eb7
13 changed files with 479 additions and 28 deletions

View File

@@ -215,6 +215,22 @@ export const api = {
method: 'POST', body: JSON.stringify({ reason: reason || '' }),
}),
adminDeleteComment: (id: number) => request(`/api/admin/comments/${id}`, { method: 'DELETE' }),
adminTrashComments: (params?: { page?: number; keyword?: string }) => {
const q = new URLSearchParams();
if (params?.page) q.set('page', String(params.page));
if (params?.keyword) q.set('keyword', params.keyword);
const qs = q.toString();
return request<{
comments: (Comment & { deleted_at: string })[];
total: number;
page: number;
total_pages: number;
}>(`/api/admin/comments/trash${qs ? `?${qs}` : ''}`);
},
adminRestoreComment: (id: number) =>
request<{ message: string }>(`/api/admin/comments/${id}/restore`, { method: 'POST' }),
adminPurgeComment: (id: number) =>
request<{ message: string }>(`/api/admin/comments/${id}/purge`, { method: 'DELETE' }),
adminCommentRevisions: (id: number) =>
request<{ revisions: CommentRevision[] }>(`/api/admin/comments/${id}/revisions`),
adminUsers: (page = 1, opts?: { keyword?: string; filter?: string }) => {