From 4cd50d481596cd061f8b301e82a7a0a7f663be70 Mon Sep 17 00:00:00 2001 From: wispx <1591788658@qq.com> Date: Wed, 5 Dec 2018 14:41:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8A=E4=BC=A0=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/index/controller/Upload.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/application/index/controller/Upload.php b/application/index/controller/Upload.php index 5c133b75..391ba454 100644 --- a/application/index/controller/Upload.php +++ b/application/index/controller/Upload.php @@ -22,7 +22,7 @@ class Upload extends Base Db::startTrans(); try { if (!$this->config['allowed_tourist_upload'] && !$this->user) { - throw new Exception('管理员关闭了游客上传!', 401); + throw new Exception('管理员关闭了游客上传!'); } $image = $this->getImage(); @@ -33,7 +33,7 @@ class Upload extends Base if ($this->user) { if (($this->user->use_quota + $size) > $this->user->quota) { - throw new Exception('保存失败!您的储存容量不足,请联系管理员!', 0); + throw new Exception('保存失败!您的储存容量不足,请联系管理员!'); } } @@ -47,9 +47,9 @@ class Upload extends Base $pathname = strtolower($this->makePathname($image->getInfo('name'))); if (!$strategy->create($pathname, $image->getPathname())) { if (Config::get('app.app_debug')) { - throw new Exception($strategy->getError(), 500); + throw new Exception($strategy->getError()); } - throw new Exception('上传失败', 500); + throw new Exception('上传失败'); } $cdnDomain = $currentStrategy . '_cdn_domain'; @@ -70,11 +70,11 @@ class Upload extends Base if (0 == $result->error_code) { if ($result->rating_index >= $this->config['audit_index']) { $strategy->delete($pathname); - throw new Exception('图片[' . $image->getInfo('name') . ']涉嫌违规,禁止上传!', 0); + throw new Exception('图片[' . $image->getInfo('name') . ']涉嫌违规,禁止上传!'); } } else { $strategy->delete($pathname); - throw new Exception($result->error, 0); + throw new Exception($result->error); } } } @@ -91,7 +91,7 @@ class Upload extends Base 'md5' => $md5 ])) { $strategy->delete($pathname); - throw new Exception('图片数据保存失败', 500); + throw new Exception('图片数据保存失败'); } $data = [ @@ -106,7 +106,7 @@ class Upload extends Base Db::commit(); } catch (Exception $e) { Db::rollback(); - return $this->result(null, $e->getCode(), $e->getMessage()); + return response($e->getMessage(), 500); } return $this->result($data, 200, '上传成功');