From a8cf1aab4e83abd778cbfebda8c30faf3537e9e1 Mon Sep 17 00:00:00 2001 From: WispX <1591788658@qq.com> Date: Sat, 7 Mar 2020 14:44:02 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=94=B9=E8=BF=9B=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E5=92=8C=E4=BB=A3=E7=A0=81=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common/model/Images.php | 2 +- application/index/controller/User.php | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/application/common/model/Images.php b/application/common/model/Images.php index 5b1afa06..79d94032 100644 --- a/application/common/model/Images.php +++ b/application/common/model/Images.php @@ -38,4 +38,4 @@ class Images extends Model { return format_time($data['create_time']); } -} \ No newline at end of file +} diff --git a/application/index/controller/User.php b/application/index/controller/User.php index 707634bf..8500b0d3 100644 --- a/application/index/controller/User.php +++ b/application/index/controller/User.php @@ -20,6 +20,7 @@ class User extends Base { public function images($keyword = '', $folderId = 0, $limit = 60) { + $images = $folders = []; if ($this->request->isPost()) { try { $model = $this->user->images()->order('create_time', 'desc'); @@ -30,11 +31,7 @@ class User extends Base if (is_numeric($folderId)) { $model = $model->where('folder_id', $folderId); } - $images = $model->paginate($limit)->each(function ($item) { - $item->url = $item->url; - // TODO 生成缩略图 - return $item; - }); + $images = $model->paginate($limit); } catch (Exception $e) { $this->error($e->getMessage()); } @@ -97,9 +94,15 @@ class User extends Base Db::commit(); } catch (Exception $e) { Db::rollback(); - return $deleteId ? false : $this->error($e->getMessage()); + if ($deleteId) { + return false; + } + $this->error($e->getMessage()); } - return $deleteId ? true : $this->success('删除成功'); + if ($deleteId) { + return true; + } + $this->success('删除成功'); } public function createFolder()