🐛 永久封存恢复前的旧取件码
This commit is contained in:
1 parent
56a86c59cf
commit
d75044e884
7 files changed
+92
-10
No files matched your search
+6
-4
@@ -31,7 +31,7 @@ from apps.admin.schemas import (
|
||||
UpdateFileData,
|
||||
)
|
||||
from core.response import APIResponse
|
||||
from apps.base.models import FileCodes, KeyValue, TransferStats
|
||||
from apps.base.models import FileCodes, KeyValue, ShareCodeReservations, TransferStats
|
||||
from apps.admin.dependencies import (
|
||||
create_token,
|
||||
get_admin_session_expire_seconds,
|
||||
@@ -859,9 +859,11 @@ async def update_file(
|
||||
update_data = {}
|
||||
|
||||
if data.code is not None and data.code != file_code.code:
|
||||
# 判断code是否存在
|
||||
if await FileCodes.filter(code=data.code).first():
|
||||
raise HTTPException(status_code=400, detail="code已存在")
|
||||
# 当前记录和全部退役取件码都不可重复使用。
|
||||
if await FileCodes.filter(code=data.code).first() or await ShareCodeReservations.filter(
|
||||
code=data.code
|
||||
).first():
|
||||
raise HTTPException(status_code=400, detail="取件码已被占用")
|
||||
update_data["code"] = data.code
|
||||
if data.prefix is not None and data.prefix != file_code.prefix:
|
||||
update_data["prefix"] = data.prefix
|
||||
|
||||
Reference in new issue
Block a user