BirdNETM | b0f7153 | 2025-05-26 17:37:33 +0800 | [diff] [blame] | 1 | import { request } from '@umijs/max'; |
| 2 | import type { SysTorrentComment } from '@/pages/Torrent/Comments/data'; |
| 3 | |
| 4 | /** 获取种子评论列表 */ |
| 5 | export async function listComments(torrentId: number) { |
| 6 | return request<SysTorrentComment[]>(`/api/system/torrent/comment/list`, { |
| 7 | method: 'get', |
| 8 | params: { torrentId }, |
| 9 | }); |
| 10 | } |
| 11 | |
| 12 | /** 新增评论 */ |
| 13 | export async function addComment(data: { |
| 14 | torrentId: number; |
| 15 | userId: number; |
| 16 | content: string; |
| 17 | parentId?: number; |
| 18 | }) { |
| 19 | return request(`/api/system/torrent/comment`, { |
| 20 | method: 'post', |
| 21 | data, |
| 22 | }); |
| 23 | } |
| 24 | |
| 25 | /** 删除评论 */ |
| 26 | export async function deleteComment(commentId: number) { |
| 27 | return request(`/api/system/torrent/comment/${commentId}`, { |
| 28 | method: 'delete', |
| 29 | }); |
| 30 | } |