const bcrypt = require('bcryptjs'); async function createAdminHash() { const password = 'admin123'; const saltRounds = 10; try { const hash = await bcrypt.hash(password, saltRounds); console.log('管理员密码哈希:', hash); // 生成插入SQL const sql = ` INSERT INTO users (email, password_hash, name, phone, user_type, status, created_at, updated_at) VALUES ( 'admin@example.com', '${hash}', '系统管理员', '13800138000', 'admin', 'active', NOW(), NOW() );`; console.log('\n插入SQL:'); console.log(sql); } catch (error) { console.error('生成哈希失败:', error); } } createAdminHash();