修改 手机端 显示名称错位的问题

This commit is contained in:
2025-09-24 13:41:35 +08:00
parent 590f5fdeb5
commit 9229444a2d
7 changed files with 690 additions and 48 deletions

View File

@@ -99,6 +99,31 @@ app.get("/test-db", async (req, res) => {
res.send("FAIL");
}
});
app.post("/user", async (req, res) => {
try {
const { userId } = req.body; // 从请求体里拿到 user_id
if (!userId) {
return res.status(400).send("缺少 user_id");
}
// 查询 user_name
const [rows] = await pool.query(
"SELECT user_name FROM sys_user WHERE user_id = ?",
[userId]
);
if (rows.length === 0) {
return res.status(404).send("未找到该用户");
}
res.json({ code:0,userId, userName: rows[0].user_name });
} catch (err) {
console.error(err);
res.status(500).send("服务器错误");
}
});
// 查询用户所有会话列表
app.get("/sessions", async (req, res) => {