feat(notify): add platform/ID to quota alert email, add recharge URL to balance alert

- Quota alert email now shows account ID and platform
- Balance low email includes a "Top Up Now" button when recharge URL is configured
- New setting: balance_low_notify_recharge_url in admin settings
This commit is contained in:
erio
2026-04-13 18:39:45 +08:00
parent e27335acdd
commit c1eb79e4ba
11 changed files with 136 additions and 30 deletions

View File

@@ -138,6 +138,7 @@ export interface SystemSettings {
// Balance & quota notification
balance_low_notify_enabled: boolean
balance_low_notify_threshold: number
balance_low_notify_recharge_url: string
account_quota_notify_enabled: boolean
account_quota_notify_emails: NotifyEmailEntry[]
}
@@ -242,6 +243,7 @@ export interface UpdateSettingsRequest {
// Balance & quota notification
balance_low_notify_enabled?: boolean
balance_low_notify_threshold?: number
balance_low_notify_recharge_url?: string
account_quota_notify_enabled?: boolean
account_quota_notify_emails?: NotifyEmailEntry[]
}

View File

@@ -4649,6 +4649,9 @@ export default {
threshold: 'Default Threshold',
thresholdHint: 'Used when user has not set a custom value',
thresholdPlaceholder: 'Enter amount',
rechargeUrl: 'Recharge Page URL',
rechargeUrlPlaceholder: 'https://example.com/payment',
rechargeUrlHint: 'A top-up button will appear in the email when set',
},
quotaNotify: {
title: 'Account Quota Notification',

View File

@@ -4813,6 +4813,9 @@ export default {
threshold: '默认提醒阈值',
thresholdHint: '用户未自定义时使用此值',
thresholdPlaceholder: '输入金额',
rechargeUrl: '充值页面 URL',
rechargeUrlPlaceholder: 'https://example.com/payment',
rechargeUrlHint: '设置后邮件中将包含充值链接按钮',
},
quotaNotify: {
title: '账号限额通知',

View File

@@ -2705,6 +2705,11 @@
</div>
<p class="mt-1 text-xs text-gray-500 dark:text-gray-400">{{ t('admin.settings.balanceNotify.thresholdHint') }}</p>
</div>
<div>
<label class="mb-2 block text-sm font-medium text-gray-700 dark:text-gray-300">{{ t('admin.settings.balanceNotify.rechargeUrl') }}</label>
<input v-model="form.balance_low_notify_recharge_url" type="url" class="input" :placeholder="t('admin.settings.balanceNotify.rechargeUrlPlaceholder')" />
<p class="mt-1 text-xs text-gray-500 dark:text-gray-400">{{ t('admin.settings.balanceNotify.rechargeUrlHint') }}</p>
</div>
</div>
</div>
@@ -3027,6 +3032,7 @@ const form = reactive<SettingsForm>({
// Balance & quota notification
balance_low_notify_enabled: false,
balance_low_notify_threshold: 0,
balance_low_notify_recharge_url: '',
account_quota_notify_enabled: false,
account_quota_notify_emails: [] as NotifyEmailEntry[]
})
@@ -3598,6 +3604,7 @@ async function saveSettings() {
// Balance & quota notification
balance_low_notify_enabled: form.balance_low_notify_enabled,
balance_low_notify_threshold: Number(form.balance_low_notify_threshold) || 0,
balance_low_notify_recharge_url: form.balance_low_notify_recharge_url || '',
account_quota_notify_enabled: form.account_quota_notify_enabled,
account_quota_notify_emails: (form.account_quota_notify_emails || []).filter((e) => e.email.trim() !== ''),
}