75 lines
2.6 KiB
JavaScript
75 lines
2.6 KiB
JavaScript
|
|
// Mock数据规则配置
|
||
|
|
// 定义每个表的数据生成规则和数据量范围
|
||
|
|
|
||
|
|
const mockRules = {
|
||
|
|
// 数据量配置(中等规模)
|
||
|
|
counts: {
|
||
|
|
users: { min: 50, max: 100 },
|
||
|
|
categories: { min: 20, max: 30 },
|
||
|
|
products: { min: 200, max: 500 },
|
||
|
|
productCategories: { min: 300, max: 800 },
|
||
|
|
orders: { min: 100, max: 300 },
|
||
|
|
orderItems: { min: 300, max: 900 },
|
||
|
|
addresses: { min: 80, max: 150 },
|
||
|
|
reviews: { min: 150, max: 400 },
|
||
|
|
cartItems: { min: 100, max: 250 },
|
||
|
|
productViews: { min: 500, max: 1000 },
|
||
|
|
coupons: { min: 20, max: 40 },
|
||
|
|
userCoupons: { min: 60, max: 120 },
|
||
|
|
wishlists: { min: 80, max: 160 },
|
||
|
|
payments: { min: 100, max: 300 },
|
||
|
|
admins: { min: 5, max: 10 }
|
||
|
|
},
|
||
|
|
|
||
|
|
// 数据生成选项
|
||
|
|
options: {
|
||
|
|
// 用户相关
|
||
|
|
userStatuses: [0, 1], // 0=禁用, 1=活跃
|
||
|
|
adminRoles: ['super_admin', 'admin', 'staff'],
|
||
|
|
|
||
|
|
// 分类相关
|
||
|
|
topCategoryNames: [
|
||
|
|
'电子产品', '服装服饰', '家居用品', '食品饮料',
|
||
|
|
'图书音像', '运动户外', '美妆个护', '母婴玩具'
|
||
|
|
],
|
||
|
|
subCategoryNames: [
|
||
|
|
'手机', '电脑', '平板', '耳机', '智能手表',
|
||
|
|
'上衣', '裤子', '裙子', '外套', '鞋类',
|
||
|
|
'家具', '厨具', '家纺', '装饰', '灯具',
|
||
|
|
'零食', '饮料', '生鲜', '粮油', '调味'
|
||
|
|
],
|
||
|
|
|
||
|
|
// 产品相关
|
||
|
|
brands: [
|
||
|
|
'Apple', '华为', '小米', '三星', '联想',
|
||
|
|
'戴尔', '惠普', '索尼', '佳能', '尼康',
|
||
|
|
'海尔', '美的', '格力', '苏泊尔', '飞利浦'
|
||
|
|
],
|
||
|
|
productStatuses: [0, 1, 2], // 0=下架, 1=上架, 2=缺货
|
||
|
|
|
||
|
|
// 订单相关
|
||
|
|
paymentMethods: ['支付宝', '微信支付', '信用卡', '银行转账'],
|
||
|
|
paymentStatuses: ['pending', 'paid', 'failed', 'refunded'],
|
||
|
|
orderStatuses: ['pending', 'confirmed', 'shipped', 'delivered', 'cancelled', 'completed'],
|
||
|
|
|
||
|
|
// 地址相关
|
||
|
|
provinces: [
|
||
|
|
'北京市', '上海市', '天津市', '重庆市',
|
||
|
|
'河北省', '山西省', '辽宁省', '吉林省', '黑龙江省',
|
||
|
|
'江苏省', '浙江省', '安徽省', '福建省', '江西省', '山东省',
|
||
|
|
'河南省', '湖北省', '湖南省', '广东省', '海南省',
|
||
|
|
'四川省', '贵州省', '云南省', '陕西省', '甘肃省',
|
||
|
|
'青海省', '台湾省', '内蒙古自治区', '广西壮族自治区',
|
||
|
|
'西藏自治区', '宁夏回族自治区', '新疆维吾尔自治区',
|
||
|
|
'香港特别行政区', '澳门特别行政区'
|
||
|
|
],
|
||
|
|
|
||
|
|
// 优惠券相关
|
||
|
|
couponTypes: ['percentage', 'fixed'],
|
||
|
|
|
||
|
|
// 其他
|
||
|
|
ratings: [1, 2, 3, 4, 5]
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
module.exports = mockRules;
|