const mysql = require('mysql2/promise'); async function checkUserJudgeInfo() { const connection = await mysql.createConnection({ host: '139.155.104.10', port: 3306, user: 'ryc', password: 'KiYap3E8X8RLcM6T', database: 'ryc' }); try { console.log('检查用户ID=152的信息...\n'); // 检查用户基本信息 const [userRows] = await connection.execute( 'SELECT id, name, phone, wx_openid FROM t_user WHERE id = ?', [152] ); if (userRows.length > 0) { console.log('用户基本信息:'); console.log(userRows[0]); } else { console.log('未找到用户ID=152的记录'); return; } // 检查评委信息 const [judgeRows] = await connection.execute( 'SELECT id, user_id, name, title, company, state FROM t_judge WHERE user_id = ?', [152] ); if (judgeRows.length > 0) { console.log('\n评委信息:'); console.log(judgeRows[0]); } else { console.log('\n未找到该用户的评委记录'); } // 检查员工信息 const [employeeRows] = await connection.execute( 'SELECT id, user_id, name, phone, role_id, state FROM t_employee WHERE user_id = ?', [152] ); if (employeeRows.length > 0) { console.log('\n员工信息:'); console.log(employeeRows[0]); } else { console.log('\n未找到该用户的员工记录'); } // 检查学员信息 const [playerRows] = await connection.execute( 'SELECT id, user_id, name, phone, state FROM t_player WHERE user_id = ?', [152] ); if (playerRows.length > 0) { console.log('\n学员信息:'); console.log(playerRows[0]); } else { console.log('\n未找到该用户的学员记录'); } } catch (error) { console.error('查询失败:', error); } finally { await connection.end(); } } checkUserJudgeInfo().catch(console.error);