feat: enhance download traffic quota lifecycle controls

This commit is contained in:
2026-02-17 17:19:25 +08:00
parent 2629237f9e
commit 7687397954
5 changed files with 635 additions and 53 deletions

View File

@@ -3190,6 +3190,12 @@
不限
</div>
</div>
<div style="font-size: 11px; color: var(--text-muted); margin-top: 2px;">
{{ getDownloadResetCycleText(u.download_traffic_reset_cycle || 'none') }}
</div>
<div v-if="u.download_traffic_quota_expires_at" style="font-size: 11px; color: #f59e0b; margin-top: 2px;">
到期: {{ formatDate(u.download_traffic_quota_expires_at) }}
</div>
</td>
<td style="padding: 10px; text-align: center;">
<span v-if="u.is_banned" style="color: #ef4444; font-weight: 600;">已封禁</span>
@@ -3534,29 +3540,81 @@
<div class="form-group">
<label class="form-label">下载流量配额</label>
<div style="display: flex; align-items: center; gap: 10px; margin-bottom: 8px;">
<label style="display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary);">
<input type="checkbox" v-model="editStorageForm.download_quota_unlimited">
不限流量
</label>
<div style="display: flex; gap: 10px; margin-bottom: 8px;">
<select class="form-input" v-model="editStorageForm.download_quota_operation" style="flex: 1;">
<option value="set">直接设置</option>
<option value="increase">增加额度</option>
<option value="decrease">减少额度</option>
</select>
</div>
<div v-if="!editStorageForm.download_quota_unlimited" style="display: flex; gap: 10px;">
<div v-if="editStorageForm.download_quota_operation === 'set'">
<div style="display: flex; align-items: center; gap: 10px; margin-bottom: 8px;">
<label style="display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary);">
<input type="checkbox" v-model="editStorageForm.download_quota_unlimited">
不限流量
</label>
</div>
<div v-if="!editStorageForm.download_quota_unlimited" style="display: flex; gap: 10px;">
<input
type="number"
class="form-input"
v-model.number="editStorageForm.download_traffic_quota_value"
min="1"
max="10240"
step="1"
style="flex: 1;">
<select class="form-input" v-model="editStorageForm.download_quota_unit" style="width: 100px;">
<option value="MB">MB</option>
<option value="GB">GB</option>
<option value="TB">TB</option>
</select>
</div>
</div>
<div v-else style="display: flex; gap: 10px;">
<input
type="number"
class="form-input"
v-model.number="editStorageForm.download_traffic_quota_value"
v-model.number="editStorageForm.download_quota_adjust_value"
min="1"
max="10240"
step="1"
style="flex: 1;">
<select class="form-input" v-model="editStorageForm.download_quota_unit" style="width: 100px;">
<select class="form-input" v-model="editStorageForm.download_quota_adjust_unit" style="width: 100px;">
<option value="MB">MB</option>
<option value="GB">GB</option>
<option value="TB">TB</option>
</select>
</div>
<small style="color: var(--text-secondary); font-size: 12px; margin-top: 5px; display: block;">
下载流量范围: 不限 或 1MB - 10TB(按实际下载字节扣减)
下载流量支持直接设置、增减操作,范围: 不限 或 1MB - 10TB
</small>
</div>
<div class="form-group">
<label class="form-label">下载流量到期时间(可选)</label>
<input type="datetime-local" class="form-input" v-model="editStorageForm.download_quota_expires_at">
<small style="color: var(--text-secondary); font-size: 12px; margin-top: 5px; display: block;">
到期后自动恢复为不限流量并清零已用流量;留空表示永不过期
</small>
</div>
<div class="form-group">
<label class="form-label">下载流量重置周期</label>
<select class="form-input" v-model="editStorageForm.download_quota_reset_cycle">
<option value="none">不自动重置</option>
<option value="daily">每日重置</option>
<option value="weekly">每周重置</option>
<option value="monthly">每月重置</option>
</select>
<label style="display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); margin-top: 8px;">
<input type="checkbox" v-model="editStorageForm.reset_download_used_now">
保存时立即将已用流量清零
</label>
<small style="color: var(--text-secondary); font-size: 12px; margin-top: 5px; display: block;">
可用于按日/周/月重置下载流量使用量
</small>
</div>
@@ -3568,7 +3626,10 @@
({{ editStorageForm.quota_unit === 'GB' ? (editStorageForm.local_storage_quota_value * 1024).toFixed(0) : editStorageForm.local_storage_quota_value }} MB)<br>
• 当前 OSS 配额: {{ editStorageForm.oss_storage_quota_value + ' ' + editStorageForm.oss_quota_unit }}<br>
• 已用下载流量: {{ formatBytes(editStorageForm.download_traffic_used || 0) }}<br>
当前下载流量配额: {{ editStorageForm.download_quota_unlimited ? '不限' : (editStorageForm.download_traffic_quota_value + ' ' + editStorageForm.download_quota_unit) }}
下载策略: {{ editStorageForm.download_quota_operation === 'set' ? '直接设置' : (editStorageForm.download_quota_operation === 'increase' ? '增加额度' : '减少额度') }}<br>
• 当前下载流量配额: {{ editStorageForm.download_quota_unlimited ? '不限' : (editStorageForm.download_traffic_quota_value + ' ' + editStorageForm.download_quota_unit) }}<br>
• 自动重置: {{ getDownloadResetCycleText(editStorageForm.download_quota_reset_cycle) }}<br>
• 到期时间: {{ editStorageForm.download_quota_expires_at ? editStorageForm.download_quota_expires_at.replace('T', ' ') : '无' }}
</div>
</div>