From 353633f06121518a1776c9dd0e2d75676c6f0236 Mon Sep 17 00:00:00 2001 From: duxingchen Date: Wed, 5 Aug 2026 16:10:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20409=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E5=8F=AF=E8=A7=81=20+=20PENDING=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E6=8B=A6=E6=88=AA(=E5=BF=85=E9=A1=BB=E5=85=88?= =?UTF-8?q?=E6=8E=A5=E6=94=B6)=20+=20request.js=E6=98=BE=E7=A4=BA409?= =?UTF-8?q?=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/services/task_service.py | 8 +++++++- track-uniapp/src/utils/request.js | 6 +++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/backend/app/services/task_service.py b/backend/app/services/task_service.py index 6464f1f..1876611 100644 --- a/backend/app/services/task_service.py +++ b/backend/app/services/task_service.py @@ -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),请先接收再转交", ) # 校验:卡点逻辑 — 检查关键子任务 diff --git a/track-uniapp/src/utils/request.js b/track-uniapp/src/utils/request.js index aa3e5de..d3acb94 100644 --- a/track-uniapp/src/utils/request.js +++ b/track-uniapp/src/utils/request.js @@ -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); } },