添加 IntelliJ IDEA 项目配置文件

This commit is contained in:
ylweng
2025-09-04 09:04:58 +08:00
parent 501c218a83
commit 86322c6f50
10 changed files with 17890 additions and 167 deletions

View File

@@ -0,0 +1,78 @@
const User = require('../models/User');
// 创建初始用户数据
const createInitialUsers = async () => {
try {
// 检查是否已存在用户
const existingAdmin = await User.findOne({ where: { username: 'admin' } });
if (existingAdmin) {
console.log('✅ 初始用户已存在,跳过创建');
return;
}
// 创建管理员用户
const adminUser = await User.createUser({
username: 'admin',
password: 'admin123',
phone: '13800138000',
email: 'admin@niumall.com',
real_name: '系统管理员',
user_type: 'admin'
});
// 创建采购人用户
const buyerUser = await User.createUser({
username: 'buyer',
password: 'buyer123',
phone: '13800138001',
email: 'buyer@niumall.com',
real_name: '采购经理',
user_type: 'client'
});
// 创建贸易商用户
const traderUser = await User.createUser({
username: 'trader',
password: 'trader123',
phone: '13800138002',
email: 'trader@niumall.com',
real_name: '贸易商经理',
user_type: 'staff'
});
// 创建供应商用户
const supplierUser = await User.createUser({
username: 'supplier',
password: 'supplier123',
phone: '13800138003',
email: 'supplier@niumall.com',
real_name: '供应商代表',
user_type: 'supplier'
});
// 创建司机用户
const driverUser = await User.createUser({
username: 'driver',
password: 'driver123',
phone: '13800138004',
email: 'driver@niumall.com',
real_name: '运输司机',
user_type: 'driver'
});
console.log('✅ 初始用户创建成功');
console.log('👤 用户账号信息:');
console.log(' 管理员: admin / admin123');
console.log(' 采购人: buyer / buyer123');
console.log(' 贸易商: trader / trader123');
console.log(' 供应商: supplier / supplier123');
console.log(' 司机: driver / driver123');
} catch (error) {
console.error('❌ 创建初始用户失败:', error);
}
};
module.exports = {
createInitialUsers
};