feat: 拆分邮件通知选项,根据会员权益显示
- 翻译完成邮件通知(所有用户) - 鮮件带附件发送(VIP专属,free用户显示需VIP) - 会员到期提醒(仅VIP用户显示) - 添加 notify_with_attachment 字段 - 更新各等级权益:email_notify/email_attachment
This commit is contained in:
17
app.py
17
app.py
@@ -223,6 +223,8 @@ def pricing():
|
||||
'priority_queue': '优先处理队列',
|
||||
'custom_instruction': '自定义翻译要求',
|
||||
'api_access': 'API接口调用',
|
||||
'email_notify': '邮件通知',
|
||||
'email_attachment': '邮件附件发送',
|
||||
}
|
||||
|
||||
# 从数据库读取动态配置的会员套餐
|
||||
@@ -289,10 +291,15 @@ def profile():
|
||||
daily_remaining = limits['daily_translations'] - user.daily_count if limits['daily_translations'] > 0 else '无限'
|
||||
max_pages = limits['max_pages'] if limits['max_pages'] > 0 else '无限'
|
||||
|
||||
# 检查是否有邮件附件权限
|
||||
user_features = limits.get('features', [])
|
||||
has_email_attachment = 'email_attachment' in user_features or user_features == ['all']
|
||||
|
||||
return render_template('profile.html',
|
||||
user=user,
|
||||
daily_remaining=daily_remaining,
|
||||
max_pages=max_pages
|
||||
max_pages=max_pages,
|
||||
has_email_attachment=has_email_attachment
|
||||
)
|
||||
|
||||
|
||||
@@ -876,6 +883,14 @@ def update_settings():
|
||||
user.notify_on_complete = data.get('notify_on_complete', True)
|
||||
if 'notify_on_expire' in data:
|
||||
user.notify_on_expire = data.get('notify_on_expire', True)
|
||||
if 'notify_with_attachment' in data:
|
||||
# 检查是否有附件权限
|
||||
limits = USER_LIMITS.get(user.user_type, USER_LIMITS['free'])
|
||||
user_features = limits.get('features', [])
|
||||
if 'email_attachment' in user_features or user_features == ['all']:
|
||||
user.notify_with_attachment = data.get('notify_with_attachment', False)
|
||||
else:
|
||||
return jsonify({'error': '邮件附件功能需VIP会员', 'feature': 'email_attachment'}), 403
|
||||
if 'email_notify' in data:
|
||||
user.email_notify = data.get('email_notify', True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user