Files
vf_react/database_migration_add_pricing_options.sql
2025-11-07 08:13:12 +08:00

60 lines
2.9 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 数据库迁移:添加 pricing_options 字段,支持灵活的计费周期
-- 执行时间2025-01-XX
-- 说明:支持用户选择"包N个月"或"包N年"的套餐
-- 1. 添加 pricing_options 字段
ALTER TABLE subscription_plans
ADD COLUMN pricing_options TEXT NULL COMMENT 'JSON格式的计费周期选项';
-- 2. 为Pro套餐配置多种计费周期基于现有价格198元/月2000元/年)
UPDATE subscription_plans
SET pricing_options = '[
{"months": 1, "price": 198, "label": "月付", "cycle_key": "monthly"},
{"months": 3, "price": 534, "label": "3个月", "cycle_key": "3months", "discount_percent": 10},
{"months": 6, "price": 950, "label": "半年", "cycle_key": "6months", "discount_percent": 20},
{"months": 12, "price": 2000, "label": "1年", "cycle_key": "yearly", "discount_percent": 16},
{"months": 24, "price": 3600, "label": "2年", "cycle_key": "2years", "discount_percent": 24},
{"months": 36, "price": 5040, "label": "3年", "cycle_key": "3years", "discount_percent": 29}
]'
WHERE name = 'pro';
-- 3. 为Max套餐配置多种计费周期基于现有价格998元/月10000元/年)
UPDATE subscription_plans
SET pricing_options = '[
{"months": 1, "price": 998, "label": "月付", "cycle_key": "monthly"},
{"months": 3, "price": 2695, "label": "3个月", "cycle_key": "3months", "discount_percent": 10},
{"months": 6, "price": 4790, "label": "半年", "cycle_key": "6months", "discount_percent": 20},
{"months": 12, "price": 10000, "label": "1年", "cycle_key": "yearly", "discount_percent": 17},
{"months": 24, "price": 18000, "label": "2年", "cycle_key": "2years", "discount_percent": 25},
{"months": 36, "price": 25200, "label": "3年", "cycle_key": "3years", "discount_percent": 30}
]'
WHERE name = 'max';
-- ========================================
-- 价格计算说明
-- ========================================
-- Pro版198元/月2000元/年):
-- - 月付198元
-- - 3个月198×3×0.9 = 534元打9折省10%
-- - 半年198×6×0.8 = 950元打8折省20%
-- - 1年2000元已有年付价格约省16%
-- - 2年198×24×0.76 = 3600元省24%
-- - 3年198×36×0.7 = 5040元省30%
-- Max版998元/月10000元/年):
-- - 月付998元
-- - 3个月998×3×0.9 = 2695元打9折省10%
-- - 半年998×6×0.8 = 4790元打8折省20%
-- - 1年10000元已有年付价格约省17%
-- - 2年998×24×0.75 = 18000元省25%
-- - 3年998×36×0.7 = 25200元省30%
-- ========================================
-- 注意事项
-- ========================================
-- 1. 上述价格仅为示例,请根据实际营销策略调整
-- 2. 折扣力度建议:时间越长,优惠越大
-- 3. 如果不想提供某个周期,直接从数组中删除即可
-- 4. 前端会自动渲染所有可用的计费周期选项
-- 5. 用户可以通过优惠码获得额外折扣