修复: 409错误提示可见 + PENDING状态拦截(必须先接收) + request.js显示409详情
This commit is contained in:
@ -385,7 +385,13 @@ async def transfer_task(
|
||||
if task.status == TASK_STATUS_COMPLETED:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_409_CONFLICT,
|
||||
detail=f"任务「{task.task_name}」已经完成,无需重复操作",
|
||||
detail=f"任务「{task.task_name}」已经完成(当前状态: {task.status}),请刷新页面",
|
||||
)
|
||||
# 校验:PENDING 状态不允许转交(必须先接收)
|
||||
if task.status == TASK_STATUS_PENDING:
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_409_CONFLICT,
|
||||
detail=f"任务「{task.task_name}」尚未接收(当前状态: PENDING),请先接收再转交",
|
||||
)
|
||||
|
||||
# 校验:卡点逻辑 — 检查关键子任务
|
||||
|
||||
@ -33,8 +33,12 @@ export default function request(options) {
|
||||
} else if (code === 400) {
|
||||
uni.showToast({ title: res.data?.detail || "请求参数有误", icon: "none", duration: 2500 });
|
||||
reject(res);
|
||||
} else if (code === 409) {
|
||||
uni.showToast({ title: res.data?.detail || "操作冲突", icon: "none", duration: 3000 });
|
||||
reject(res);
|
||||
} else {
|
||||
uni.showToast({ title: `请求失败 (${code})`, icon: "none" });
|
||||
const detail = res.data?.detail || "";
|
||||
uni.showToast({ title: detail ? `${detail}` : `请求失败 (${code})`, icon: "none", duration: 3000 });
|
||||
reject(res);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user