feat: make zero download quota block downloads and use -1 for unlimited

This commit is contained in:
2026-02-17 19:25:39 +08:00
parent 53e77ebf4e
commit 978ae545e1
4 changed files with 58 additions and 34 deletions

View File

@@ -3335,10 +3335,10 @@
</div>
</td>
<td style="padding: 10px; text-align: center; font-size: 12px;">
<div v-if="u.download_traffic_quota > 0">
<div v-if="u.download_traffic_quota >= 0">
<div>{{ formatBytes(u.download_traffic_used || 0) }} / {{ formatBytes(u.download_traffic_quota) }}</div>
<div style="font-size: 11px; color: var(--text-muted);">
{{ getAdminUserDownloadQuotaPercentage(u) }}%
{{ u.download_traffic_quota === 0 ? '已禁用下载' : (getAdminUserDownloadQuotaPercentage(u) + '%') }}
</div>
</div>
<div v-else>
@@ -3709,7 +3709,7 @@
<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">
不限流量
不限流量-1
</label>
</div>
<div v-if="!editStorageForm.download_quota_unlimited" style="display: flex; gap: 10px;">
@@ -3717,7 +3717,7 @@
type="number"
class="form-input"
v-model.number="editStorageForm.download_traffic_quota_value"
min="1"
min="0"
max="10240"
step="1"
style="flex: 1;">
@@ -3746,7 +3746,7 @@
</div>
<small style="color: var(--text-secondary); font-size: 12px; margin-top: 5px; display: block;">
下载流量支持直接设置、增减操作,范围: 不限 或 1MB - 10TB
下载流量支持直接设置、增减操作,范围: 0B - 10TB;勾选“不限流量(-1”表示不限制
</small>
</div>
@@ -3754,7 +3754,7 @@
<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;">
到期后自动恢复为不限流量并清零已用流量;留空表示永不过期
到期后自动恢复为 0 并清零已用流量;留空表示永不过期
</small>
</div>