diff --git a/server/src/routes/role.routes.js b/server/src/routes/role.routes.js index 4ad23f5..f5bb120 100644 --- a/server/src/routes/role.routes.js +++ b/server/src/routes/role.routes.js @@ -30,7 +30,7 @@ router.post("/item/send", async (req, res) => { const role = roleId[0].id; const result = await axios.post( "http://192.168.25.110:19000/center/gm", - { role, item: [itemId, itemNum] }, + { role, item: [[itemId, itemNum]] }, { headers: { Accept: "application/json, text/plain, */*", @@ -44,7 +44,8 @@ router.post("/item/send", async (req, res) => { } ); console.log("物品[%s]发送给[%s]结果:%s", itemId, roleName, result.data); - res.json({ code: 0, msg: "发送成功!" }); + if (result.data.result) res.json({ code: 0, msg: "发送成功!" }); + else res.json({ code: 1, msg: result.data.content }); } catch (error) { console.error("获取角色数据失败:", error); res.status(500).json({ error: "获取角色数据失败" });