From 2f47cf4b550e5fd533a6b20b6e2b2f024e2d6e10 Mon Sep 17 00:00:00 2001 From: luozhj33 Date: Thu, 19 Mar 2026 14:18:43 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93users=E8=A1=A8=E5=90=8D=E4=B8=BAuser?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/src/controllers/user.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/back/src/controllers/user.js b/back/src/controllers/user.js index b4c5b1f..0a13b76 100644 --- a/back/src/controllers/user.js +++ b/back/src/controllers/user.js @@ -23,7 +23,7 @@ async function register(req, res) { try { // 检查用户名是否已存在 const existingUser = await mysql.query( - 'SELECT id FROM users WHERE username = ? AND is_deleted = 0', + 'SELECT id FROM user WHERE username = ? AND is_deleted = 0', [username] ); if (existingUser.length > 0) { @@ -35,7 +35,7 @@ async function register(req, res) { const salt = generateSalt(); const hash = hashPassword(password, salt); await mysql.query( - 'INSERT INTO users (user_id, username, password, salt, email, phone) VALUES (?, ?, ?, ?, ?, ?)', + 'INSERT INTO user (user_id, username, password, salt, email, phone) VALUES (?, ?, ?, ?, ?, ?)', [user_id, username, hash, salt, email || null, phone || null] ); @@ -66,7 +66,7 @@ async function login(req, res) { try { // 查询用户(仅支持用户名登录) const users = await mysql.query( - 'SELECT user_id, username, password, salt FROM users WHERE username = ? AND is_deleted = 0', + 'SELECT user_id, username, password, salt FROM user WHERE username = ? AND is_deleted = 0', [username] ); if (users.length === 0) {