update-plans.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. const { PrismaClient } = require('@prisma/client');
  2. const prisma = new PrismaClient();
  3. async function updatePlans() {
  4. console.log('更新套餐数据...');
  5. // 删除旧套餐
  6. await prisma.subscriptionPlan.deleteMany({});
  7. console.log('已删除旧套餐');
  8. // 新套餐配置
  9. const newPlans = [
  10. {
  11. name: '免费版',
  12. level: 0,
  13. priceMonthly: 0,
  14. priceYearly: 0,
  15. description: '适合轻度体验',
  16. features: JSON.stringify([
  17. '每天3次生成',
  18. '每次最多1000字',
  19. '基础音色5种',
  20. '标准音质',
  21. 'Token成本:¥10/月(平台补贴)'
  22. ]),
  23. isRecommended: false,
  24. sortOrder: 0,
  25. dailyGenerations: 3,
  26. perGenerationLimit: 1000,
  27. monthlyTokens: 5000,
  28. yearlyTokens: null,
  29. voiceOptions: 5,
  30. audioQuality: 'standard',
  31. apiAccess: false,
  32. batchProcessing: false,
  33. teamManagement: false
  34. },
  35. {
  36. name: '入门版',
  37. level: 1,
  38. priceMonthly: 9.9,
  39. priceYearly: 99,
  40. description: '适合轻度使用',
  41. features: JSON.stringify([
  42. '每月10000 Token',
  43. '每次最多3000字',
  44. '全部音色',
  45. '高清音质',
  46. 'Token成本:¥20/月'
  47. ]),
  48. isRecommended: false,
  49. sortOrder: 1,
  50. dailyGenerations: 10,
  51. perGenerationLimit: 3000,
  52. monthlyTokens: 10000,
  53. yearlyTokens: null,
  54. voiceOptions: -1,
  55. audioQuality: 'high',
  56. apiAccess: false,
  57. batchProcessing: false,
  58. teamManagement: false
  59. },
  60. {
  61. name: '专业版',
  62. level: 2,
  63. priceMonthly: 59,
  64. priceYearly: 590,
  65. description: '适合内容创作者 ⭐推荐',
  66. features: JSON.stringify([
  67. '每月20000 Token',
  68. '每次最多10000字',
  69. '全部音色+定制音色',
  70. '无损音质',
  71. 'VIP优先队列',
  72. 'Token成本:¥40/月'
  73. ]),
  74. isRecommended: true,
  75. sortOrder: 2,
  76. dailyGenerations: 50,
  77. perGenerationLimit: 10000,
  78. monthlyTokens: 20000,
  79. yearlyTokens: null,
  80. voiceOptions: -1,
  81. audioQuality: 'lossless',
  82. apiAccess: false,
  83. batchProcessing: false,
  84. teamManagement: false
  85. },
  86. {
  87. name: '旗舰版',
  88. level: 3,
  89. priceMonthly: 199,
  90. priceYearly: 1999,
  91. description: '适合企业用户',
  92. features: JSON.stringify([
  93. '每月50000 Token',
  94. '每次最多50000字',
  95. '全部功能',
  96. '专属技术支持',
  97. '批量处理',
  98. '团队管理',
  99. 'Token成本:¥100/月'
  100. ]),
  101. isRecommended: false,
  102. sortOrder: 3,
  103. dailyGenerations: -1,
  104. perGenerationLimit: 50000,
  105. monthlyTokens: 50000,
  106. yearlyTokens: null,
  107. voiceOptions: -1,
  108. audioQuality: 'lossless',
  109. apiAccess: true,
  110. batchProcessing: true,
  111. teamManagement: true
  112. }
  113. ];
  114. // 创建新套餐
  115. for (const plan of newPlans) {
  116. await prisma.subscriptionPlan.create({ data: plan });
  117. console.log('创建套餐:', plan.name);
  118. }
  119. console.log('套餐更新完成!');
  120. }
  121. updatePlans()
  122. .catch(console.error)
  123. .finally(() => prisma.$disconnect());