🐛 永久封存恢复前的旧取件码

This commit is contained in:
orion committed 2026-08-07 10:46:45 +08:00
1 parent 56a86c59cf
commit d75044e884
7 files changed
+92 -10

No files matched your search

+6 -1
View File
@@ -17,7 +17,7 @@ from core.settings import (
)
from core.config import refresh_settings
from core.security import INTERNAL_CONFIG_KEYS, generate_jwt_secret
from apps.base.models import FileCodes, KeyValue, TransferStats, file_codes_pydantic
from apps.base.models import FileCodes, KeyValue, ShareCodeReservations, TransferStats, file_codes_pydantic
from apps.base.utils import get_expire_info, get_file_path_name, get_random_code
from apps.base.quota import release_storage, reserve_storage
@@ -178,6 +178,11 @@ class FileService:
original_path,
)
file_code.file_path = destination_dir
original_code = file_code.code
await ShareCodeReservations.get_or_create(
code=original_code,
defaults={"file_code_id": file_code.id, "reason": "restored"},
)
file_code.code = await get_random_code()
file_code.is_trashed = False
file_code.trashed_at = None