不写死

This commit is contained in:
zhx 2026-06-11 21:29:37 +08:00
parent 103b70f5e5
commit 4b16f93930
2 changed files with 7 additions and 7 deletions

View File

@ -358,19 +358,19 @@ export function generateDiceRobots(payload: DiceGenerateRobotsPayload) {
).then((result) => ({ ...result, items: (result.items || []).map(normalizeDiceRobot) }));
}
export function setDiceRobotStatus(userId: string, status: string, gameId = "dice") {
export function setDiceRobotStatus(userId: string, status: string, gameId = "") {
const endpoint = API_ENDPOINTS.setDiceRobotStatus;
return apiRequest<DiceRobotDto, { status: string }>(
apiEndpointPath(API_OPERATIONS.setDiceRobotStatus, { user_id: userId }),
{ body: { status }, method: endpoint.method, query: { gameId } },
{ body: { status }, method: endpoint.method, query: gameId ? { gameId } : undefined },
).then(normalizeDiceRobot);
}
export function deleteDiceRobot(userId: string, gameId = "dice"): Promise<{ deleted: boolean }> {
export function deleteDiceRobot(userId: string, gameId = ""): Promise<{ deleted: boolean }> {
const endpoint = API_ENDPOINTS.deleteDiceRobot;
return apiRequest<{ deleted: boolean }>(apiEndpointPath(API_OPERATIONS.deleteDiceRobot, { user_id: userId }), {
method: endpoint.method,
query: { gameId },
query: gameId ? { gameId } : undefined,
});
}

View File

@ -50,7 +50,7 @@ export function GameRobotPage() {
async (cursor = "", append = false) => {
setLoading(!append);
try {
const result = await listDiceRobots({ gameId: "dice", status, cursor, pageSize: 50 });
const result = await listDiceRobots({ status, cursor, pageSize: 50 });
setItems((current) => (append ? [...current, ...(result.items || [])] : result.items || []));
setNextCursor(result.nextCursor || "");
} catch (err) {
@ -70,7 +70,7 @@ export function GameRobotPage() {
async (robot, checked) => {
setLoadingAction(`status-${robot.userId}`);
try {
await setDiceRobotStatus(robot.userId, checked ? "active" : "disabled", robot.gameId);
await setDiceRobotStatus(robot.userId, checked ? "active" : "disabled");
await load("", false);
showToast("机器人状态已更新", "success");
} catch (err) {
@ -95,7 +95,7 @@ export function GameRobotPage() {
}
setLoadingAction(`delete-${robot.userId}`);
try {
await deleteDiceRobot(robot.userId, robot.gameId || "dice");
await deleteDiceRobot(robot.userId);
await load("", false);
showToast("全站机器人已删除", "success");
} catch (err) {