const { PrismaClient } = require('@prisma/client'); const prisma = new PrismaClient(); async function updatePlans() { console.log('更新套餐数据...'); // 删除旧套餐 await prisma.subscriptionPlan.deleteMany({}); console.log('已删除旧套餐'); // 新套餐配置 const newPlans = [ { name: '免费版', level: 0, priceMonthly: 0, priceYearly: 0, description: '适合轻度体验', features: JSON.stringify([ '每天3次生成', '每次最多1000字', '基础音色5种', '标准音质', 'Token成本:¥10/月(平台补贴)' ]), isRecommended: false, sortOrder: 0, dailyGenerations: 3, perGenerationLimit: 1000, monthlyTokens: 5000, yearlyTokens: null, voiceOptions: 5, audioQuality: 'standard', apiAccess: false, batchProcessing: false, teamManagement: false }, { name: '入门版', level: 1, priceMonthly: 9.9, priceYearly: 99, description: '适合轻度使用', features: JSON.stringify([ '每月10000 Token', '每次最多3000字', '全部音色', '高清音质', 'Token成本:¥20/月' ]), isRecommended: false, sortOrder: 1, dailyGenerations: 10, perGenerationLimit: 3000, monthlyTokens: 10000, yearlyTokens: null, voiceOptions: -1, audioQuality: 'high', apiAccess: false, batchProcessing: false, teamManagement: false }, { name: '专业版', level: 2, priceMonthly: 59, priceYearly: 590, description: '适合内容创作者 ⭐推荐', features: JSON.stringify([ '每月20000 Token', '每次最多10000字', '全部音色+定制音色', '无损音质', 'VIP优先队列', 'Token成本:¥40/月' ]), isRecommended: true, sortOrder: 2, dailyGenerations: 50, perGenerationLimit: 10000, monthlyTokens: 20000, yearlyTokens: null, voiceOptions: -1, audioQuality: 'lossless', apiAccess: false, batchProcessing: false, teamManagement: false }, { name: '旗舰版', level: 3, priceMonthly: 199, priceYearly: 1999, description: '适合企业用户', features: JSON.stringify([ '每月50000 Token', '每次最多50000字', '全部功能', '专属技术支持', '批量处理', '团队管理', 'Token成本:¥100/月' ]), isRecommended: false, sortOrder: 3, dailyGenerations: -1, perGenerationLimit: 50000, monthlyTokens: 50000, yearlyTokens: null, voiceOptions: -1, audioQuality: 'lossless', apiAccess: true, batchProcessing: true, teamManagement: true } ]; // 创建新套餐 for (const plan of newPlans) { await prisma.subscriptionPlan.create({ data: plan }); console.log('创建套餐:', plan.name); } console.log('套餐更新完成!'); } updatePlans() .catch(console.error) .finally(() => prisma.$disconnect());