feat: 添加 OSS 存储配额功能

- 数据库:添加 oss_storage_quota 字段(0 表示无限制)
- 后端:登录/用户信息返回 OSS 配额
- 后端:管理员可设置用户 OSS 配额
- 后端:上传时检查 OSS 配额限制
- 前端:管理员编辑用户增加 OSS 配额设置
- 前端:用户文件页面显示 OSS 使用量和配额

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-22 19:25:49 +08:00
parent 4bc147e53c
commit 949653ac00
6 changed files with 138 additions and 8 deletions

View File

@@ -1808,8 +1808,10 @@
<i class="fas fa-exclamation-triangle"></i> {{ ossUsageError }}
</div>
<div v-else-if="ossUsage" style="font-size: 13px; font-weight: 600; color: #4b5fc9;">
{{ ossUsage.totalSizeFormatted }}
<span style="font-weight: 400; color: var(--text-muted); font-size: 12px;">{{ ossUsage.fileCount }} 文件)</span>
{{ ossUsage.totalSizeFormatted }}
<span v-if="ossQuota > 0" style="font-weight: 400; color: var(--text-muted);">/ {{ formatBytes(ossQuota) }}</span>
<span v-else style="font-weight: 400; color: var(--text-muted);">/ 无限制</span>
<div style="font-weight: 400; color: var(--text-muted); font-size: 12px; margin-top: 4px;">{{ ossUsage.fileCount }} 文件</div>
</div>
<div v-else style="font-size: 12px; color: var(--text-muted);">点击刷新查看</div>
</div>
@@ -3109,7 +3111,19 @@
• 默认配额: 1GB<br>
• 当前配额: {{ editStorageForm.local_storage_quota_value }} {{ editStorageForm.quota_unit }}
({{ editStorageForm.quota_unit === 'GB' ? (editStorageForm.local_storage_quota_value * 1024).toFixed(0) : editStorageForm.local_storage_quota_value }} MB)<br>
配额仅影响本地存储OSS存储不受此限制
本地配额默认: 1GB | OSS配额默认: 无限制
</div>
</div>
<!-- OSS 存储配额 -->
<div class="form-group">
<label class="form-label">OSS 存储配额 <span style="color: var(--text-muted); font-weight: normal;">(0 = 无限制)</span></label>
<div style="display: flex; gap: 10px;">
<input type="number" class="form-input" v-model.number="editStorageForm.oss_storage_quota_value" min="0" max="102400" step="1" style="flex: 1;">
<select class="form-input" v-model="editStorageForm.oss_quota_unit" style="width: 100px;">
<option value="GB">GB</option>
<option value="MB">MB</option>
</select>
</div>
</div>