feat: complete multimodal ticket intake

This commit is contained in:
hailin
2026-07-27 18:59:28 +08:00
parent 96452934a3
commit 93065c0a00
39 changed files with 6443 additions and 267 deletions

View File

@@ -30,8 +30,9 @@ FORMATS = {
def prepare_image(raw: bytes, original_name: str) -> PreparedImage:
if len(raw) > 10 * 1024 * 1024:
raise DraftImageError(413, "单张图片不能超过 10 MB")
max_bytes = settings.TICKET_MATERIAL_MAX_FILE_BYTES
if len(raw) > max_bytes:
raise DraftImageError(413, f"单个材料不能超过 {max_bytes // 1024 // 1024} MB")
try:
with Image.open(io.BytesIO(raw)) as image:
image.verify()