🐛 永久封存恢复前的旧取件码
This commit is contained in:
1 parent
56a86c59cf
commit
d75044e884
7 files changed
+92
-10
No files matched your search
+4
-2
@@ -8,7 +8,7 @@ from fastapi import UploadFile, HTTPException
|
||||
from typing import Optional, Tuple
|
||||
|
||||
from apps.base.dependencies import IPRateLimit
|
||||
from apps.base.models import FileCodes
|
||||
from apps.base.models import FileCodes, ShareCodeReservations
|
||||
from core.settings import settings
|
||||
from core.utils import (
|
||||
get_random_num,
|
||||
@@ -122,7 +122,9 @@ async def get_random_code(style: str | None = None) -> str:
|
||||
if code_style == "number"
|
||||
else await get_random_string(CODE_LENGTH)
|
||||
)
|
||||
if not await FileCodes.filter(code=code).exists():
|
||||
if not await FileCodes.filter(code=code).exists() and not await ShareCodeReservations.filter(
|
||||
code=code
|
||||
).exists():
|
||||
return str(code)
|
||||
raise HTTPException(status_code=503, detail="取件码生成暂时繁忙,请重试")
|
||||
|
||||
|
||||
Reference in new issue
Block a user