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();