From 34cebffd0c9ca4a650e074b936bc7736cbd86699 Mon Sep 17 00:00:00 2001 From: kubbo <390378816@qq.com> Date: Thu, 24 Apr 2025 20:08:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(server):=20=E4=BF=AE=E5=A4=8D=E7=89=A9?= =?UTF-8?q?=E5=93=81=E5=8F=91=E9=80=81=E7=BB=93=E6=9E=9C=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将判断条件从 result.data.result 修改为 result.data == "成功" - 优化了发送结果的判断逻辑,确保正确处理发送成功和失败的情况 --- server/src/routes/role.routes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/routes/role.routes.js b/server/src/routes/role.routes.js index f5bb120..3e143ef 100644 --- a/server/src/routes/role.routes.js +++ b/server/src/routes/role.routes.js @@ -44,7 +44,7 @@ router.post("/item/send", async (req, res) => { } ); console.log("物品[%s]发送给[%s]结果:%s", itemId, roleName, result.data); - if (result.data.result) res.json({ code: 0, msg: "发送成功!" }); + if (result.data == "成功") res.json({ code: 0, msg: "发送成功!" }); else res.json({ code: 1, msg: result.data.content }); } catch (error) { console.error("获取角色数据失败:", error);