feat(admin): 标签管理与批量打标签的 API 封装

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-05 04:23:17 -06:00
parent 52ac8d205d
commit 15aaec4384
2 changed files with 36 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ import http from "utils/http"
import { toProblemListItem } from "admin/transforms"
import type {
AdminProblem,
AdminTag,
Announcement,
AnnouncementEdit,
BlankContest,
@@ -84,6 +85,35 @@ export function getContestProblem(id: number) {
return http.get("admin/contest/problem", { params: { id } })
}
// 标签管理
export function getTagAdminList(keyword = "") {
return http.get<AdminTag[]>("admin/problem/tag", { params: { keyword } })
}
export function renameTag(id: number, name: string) {
return http.put<{
merged: boolean
id: number
name: string
affected_count: number
}>("admin/problem/tag", { id, name })
}
export function deleteTag(id: number) {
return http.delete("admin/problem/tag", { params: { id } })
}
export function batchTagProblems(
problemIds: number[],
tagNames: string[],
action: "add" | "remove",
) {
return http.post<{ problem_count: number; tag_count: number }>(
"admin/problem/batch_tag",
{ problem_ids: problemIds, tag_names: tagNames, action },
)
}
// 用户列表
export function getUserList(
offset = 0,