优惠码Bug修复

This commit is contained in:
2025-11-07 08:13:12 +08:00
parent 83c6abdfba
commit a3810499cc
4 changed files with 247 additions and 59 deletions

30
app.py
View File

@@ -1443,16 +1443,24 @@ def get_subscription_plans():
'data': [plan.to_dict() for plan in plans]
})
except Exception as e:
# 返回默认套餐
# 返回默认套餐包含pricing_options以兼容新前端
default_plans = [
{
'id': 1,
'name': 'pro',
'display_name': 'Pro版本',
'description': '适合个人投资者的基础功能套餐',
'monthly_price': 0.01,
'yearly_price': 0.08,
'features': ['基础股票分析工具', '历史数据查询', '基础财务报表'],
'monthly_price': 198,
'yearly_price': 2000,
'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}
],
'features': ['基础股票分析工具', '历史数据查询', '基础财务报表', '简单投资计划记录', '标准客服支持'],
'is_active': True,
'sort_order': 1
},
@@ -1461,9 +1469,17 @@ def get_subscription_plans():
'name': 'max',
'display_name': 'Max版本',
'description': '适合专业投资者的全功能套餐',
'monthly_price': 0.1,
'yearly_price': 0.8,
'features': ['全部Pro版本功能', '高级分析工具', '实时数据推送'],
'monthly_price': 998,
'yearly_price': 10000,
'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}
],
'features': ['全部Pro版本功能', '高级分析工具', '实时数据推送', 'API访问', '优先客服支持'],
'is_active': True,
'sort_order': 2
}