update pay function
This commit is contained in:
22
app.py
22
app.py
@@ -570,6 +570,28 @@ class User(UserMixin, db.Model):
|
|||||||
'is_authenticated': True
|
'is_authenticated': True
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 获取用户订阅信息(从 user_subscriptions 表)
|
||||||
|
subscription = UserSubscription.query.filter_by(user_id=self.id).first()
|
||||||
|
if subscription:
|
||||||
|
data.update({
|
||||||
|
'subscription_type': subscription.subscription_type,
|
||||||
|
'subscription_status': subscription.subscription_status,
|
||||||
|
'billing_cycle': subscription.billing_cycle,
|
||||||
|
'start_date': subscription.start_date.isoformat() if subscription.start_date else None,
|
||||||
|
'end_date': subscription.end_date.isoformat() if subscription.end_date else None,
|
||||||
|
'auto_renew': subscription.auto_renew
|
||||||
|
})
|
||||||
|
else:
|
||||||
|
# 无订阅时使用默认值
|
||||||
|
data.update({
|
||||||
|
'subscription_type': 'free',
|
||||||
|
'subscription_status': 'inactive',
|
||||||
|
'billing_cycle': None,
|
||||||
|
'start_date': None,
|
||||||
|
'end_date': None,
|
||||||
|
'auto_renew': False
|
||||||
|
})
|
||||||
|
|
||||||
# 敏感信息只在需要时包含
|
# 敏感信息只在需要时包含
|
||||||
if include_sensitive:
|
if include_sensitive:
|
||||||
data.update({
|
data.update({
|
||||||
|
|||||||
Reference in New Issue
Block a user