test/custom-admin-ui #3

Merged
orion merged 673 commits from test/custom-admin-ui into master 2026-06-05 17:20:58 +08:00
3 changed files with 13 additions and 3 deletions
Showing only changes of commit d280a4faef - Show all commits
+4
View File
@@ -49,6 +49,10 @@ async def get_config():
@admin_api.patch('/config/update', dependencies=[Depends(admin_required)])
async def update_config(data: dict):
admin_token = data.get('admin_token')
if admin_token is None or admin_token == '':
return APIResponse(code=400, detail='管理员密码不能为空')
for k, v in data.items():
settings.__setattr__(k, v)
return APIResponse()
+2
View File
@@ -102,6 +102,7 @@ async def get_code_file(code: str, ip: str = Depends(error_ip_limit)):
return APIResponse(code=404, detail=file_code)
# 更新文件的使用次数和过期次数
file_code.used_count += 1
if file_code.expired_count > 0:
file_code.expired_count -= 1
# 保存文件
await file_code.save()
@@ -122,6 +123,7 @@ async def select_file(data: SelectFileModel, ip: str = Depends(error_ip_limit)):
return APIResponse(code=404, detail=file_code)
# 更新文件的使用次数和过期次数
file_code.used_count += 1
if file_code.expired_count > 0:
file_code.expired_count -= 1
# 保存文件
await file_code.save()
+5 -1
View File
@@ -10,7 +10,11 @@
</template>
</el-table-column>
<el-table-column prop="used_count" :label="t('admin.fileView.used_count')" />
<el-table-column prop="expired_count" :label="t('admin.fileView.expired_count')" />
<el-table-column prop="expired_count" :label="t('admin.fileView.expired_count')">
<template #default="scope">
<span>{{ scope.row.expired_count > -1 ? scope.row.expired_count : '不限次数' }}</span>
</template>
</el-table-column>
<el-table-column prop="size" :label="t('admin.fileView.size')">
<template #default="scope">
<span>{{ Math.round(scope.row.size/1024/1024*100)/100 }}MB</span>