const mongoose = require('mongoose'); mongoose.connect('mongodb://localhost:27017/e-scooter-rental') .then(async () => { console.log('✅ MongoDB 连接成功'); const Payment = require('./server/models/Payment'); // 添加更多打款数据 await Payment.insertMany([ { paymentId: 'PAY013', type: '收入', party: '骑手王某', amount: 800, method: '微信', category: '租金收入', remark: '3月租金', operator: '系统' }, { paymentId: 'PAY014', type: '支出', party: '员工C', amount: 5200, method: '银行卡', category: '工资', remark: '3月工资', operator: '财务' }, { paymentId: 'PAY015', type: '支出', party: '房东', amount: 15000, method: '银行卡', category: '房租', remark: '4月房租', operator: '财务' }, { paymentId: 'PAY016', type: '支出', party: '电力公司', amount: 2800, method: '银行卡', category: '水电', remark: '3月电费', operator: '行政' }, { paymentId: 'PAY017', type: '支出', party: '自来水公司', amount: 600, method: '银行卡', category: '水电', remark: '3月水费', operator: '行政' }, { paymentId: 'PAY018', type: '支出', party: '修理厂', amount: 1200, method: '微信', category: '维修', remark: '车辆大修', operator: '王店长' }, { paymentId: 'PAY019', type: '收入', party: '骑手孙某', amount: 450, method: '支付宝', category: '租金收入', remark: '租金', operator: '系统' }, { paymentId: 'PAY020', type: '支出', party: '保险公司', amount: 3500, method: '银行卡', category: '其他', remark: '车辆保险', operator: '财务' }, { paymentId: 'PAY021', type: '收入', party: '骑手周某', amount: 600, method: '微信', category: '租金收入', remark: '租金', operator: '系统' }, { paymentId: 'PAY022', type: '支出', party: '广告公司', amount: 2000, method: '银行卡', category: '其他', remark: '营销推广', operator: '市场' } ]); console.log('✅ 添加了 10 条打款记录'); const total = await Payment.countDocuments(); console.log('📊 打款记录总数:', total); mongoose.disconnect(); process.exit(0); }) .catch(err => console.error('❌ 错误:', err));