From fa5394ce8197aabbea5730c931cf82be380b3b93 Mon Sep 17 00:00:00 2001 From: Dai Date: Wed, 14 May 2025 19:36:39 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=90=E5=88=B6=E4=B8=8A=E4=BC=A0=E5=A4=A7?= =?UTF-8?q?=E5=B0=8F20M?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/UploadService.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/app/common/service/UploadService.php b/app/common/service/UploadService.php index e0197a6..ed984f7 100644 --- a/app/common/service/UploadService.php +++ b/app/common/service/UploadService.php @@ -25,10 +25,7 @@ class UploadService $fileSize = $file->getSize(); if ($fileSize > 20 * 1024 * 1024){ - return [ - 'code' => ResponseCode::FAIL, - 'msg' => '图片超出20M', - ]; + throw new Exception('文件超出20M'); } $uploadDir = '/files/' . $type . '/' . date('Ym') . '/'; @@ -82,10 +79,7 @@ class UploadService $fileSize = $file->getSize(); if ($fileSize > 20 * 1024 * 1024){ - return [ - 'code' => ResponseCode::FAIL, - 'msg' => '文件超出20M', - ]; + throw new Exception('文件超出20M'); } $origin_name = $file->getUploadName();