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) { |
BirdNETM | ed9f2f9 | 2025-05-26 20:12:30 +0800 | [diff] [blame^] | 6 | return request<SysTorrentComment[]>(`/api/system/torrent/comment/${torrentId}`, { |
BirdNETM | b0f7153 | 2025-05-26 17:37:33 +0800 | [diff] [blame] | 7 | method: 'get', |
BirdNETM | b0f7153 | 2025-05-26 17:37:33 +0800 | [diff] [blame] | 8 | }); |
| 9 | } |
| 10 | |
| 11 | /** 新增评论 */ |
| 12 | export async function addComment(data: { |
| 13 | torrentId: number; |
| 14 | userId: number; |
| 15 | content: string; |
| 16 | parentId?: number; |
| 17 | }) { |
| 18 | return request(`/api/system/torrent/comment`, { |
| 19 | method: 'post', |
| 20 | data, |
| 21 | }); |
| 22 | } |
| 23 | |
| 24 | /** 删除评论 */ |
| 25 | export async function deleteComment(commentId: number) { |
| 26 | return request(`/api/system/torrent/comment/${commentId}`, { |
| 27 | method: 'delete', |
| 28 | }); |
| 29 | } |