From 287b30e2c4cf11cd4b3a8245d2bf26108c2c92e0 Mon Sep 17 00:00:00 2001 From: dubai Date: Thu, 12 Feb 2026 00:51:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(request):=20=E9=92=88=E5=AF=B9ABP=20?= =?UTF-8?q?=E9=A3=8E=E6=A0=BC=E5=93=8D=E5=BA=94=E6=B7=BB=E5=8A=A0=E9=98=B2?= =?UTF-8?q?=E5=BE=A1=E6=80=A7=E6=A3=80=E6=9F=A5=EF=BC=8C=E5=A4=84=E7=90=86?= =?UTF-8?q?=20HTTP=20200=20=E7=8A=B6=E6=80=81=E4=B8=8B=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E7=9A=84=20error=20=E5=AF=B9=E8=B1=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Yi.Vben5.Vue3/apps/web-antd/src/api/request.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Yi.Vben5.Vue3/apps/web-antd/src/api/request.ts b/Yi.Vben5.Vue3/apps/web-antd/src/api/request.ts index b224a810..2b54af44 100644 --- a/Yi.Vben5.Vue3/apps/web-antd/src/api/request.ts +++ b/Yi.Vben5.Vue3/apps/web-antd/src/api/request.ts @@ -295,6 +295,14 @@ function createRequestClient(baseURL: string) { // ABP 风格:HTTP 200 即成功,直接返回数据 if (shouldUseAbpStyle(axiosResponseData)) { + // 防御性检查:200 + { error } 仍视为错误 + const abpError = axiosResponseData?.error; + if (abpError && typeof abpError.message === 'string') { + const errorMsg = abpError.message; + message.error(errorMsg); + throw new Error(errorMsg); + } + if (response.config.successMessageMode === 'modal') { Modal.success({ content: $t('http.operationSuccess'),