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:
@@ -1247,6 +1247,23 @@ function migrateToOss() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 数据库版本迁移 - 添加 OSS 配额字段
|
||||
function migrateAddOssQuota() {
|
||||
try {
|
||||
const columns = db.prepare("PRAGMA table_info(users)").all();
|
||||
const hasOssQuota = columns.some(col => col.name === 'oss_storage_quota');
|
||||
|
||||
if (!hasOssQuota) {
|
||||
console.log('[数据库迁移] 添加 OSS 配额字段...');
|
||||
db.exec();
|
||||
console.log('[数据库迁移] ✅ OSS 配额字段已添加 (默认 0 表示无限制)');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[数据库迁移] OSS 配额迁移失败:', error);
|
||||
}
|
||||
}
|
||||
|
||||
// 系统日志操作
|
||||
const SystemLogDB = {
|
||||
// 日志级别常量
|
||||
@@ -1432,6 +1449,7 @@ initDefaultSettings();
|
||||
migrateToV2(); // 执行数据库迁移
|
||||
migrateThemePreference(); // 主题偏好迁移
|
||||
migrateToOss(); // SFTP → OSS 迁移
|
||||
migrateAddOssQuota(); // 添加 OSS 配额字段
|
||||
|
||||
module.exports = {
|
||||
db,
|
||||
|
||||
Reference in New Issue
Block a user