From bf173ccacdeaf8ba8b547ae3f3a93d41053ab604 Mon Sep 17 00:00:00 2001 From: WispX <1591788658@qq.com> Date: Fri, 13 Mar 2020 00:17:29 +0800 Subject: [PATCH] =?UTF-8?q?:bug:=20=E4=BF=AE=E5=A4=8D=20BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/index/controller/User.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application/index/controller/User.php b/application/index/controller/User.php index 8500b0d3..73f44680 100644 --- a/application/index/controller/User.php +++ b/application/index/controller/User.php @@ -50,7 +50,7 @@ class User extends Base $id = $deleteId ? $deleteId : $this->request->post('id'); $deletes = []; // 需要删除的文件 if (is_array($id)) { - $images = Images::all($id); + $images = Images::all(['id' => $id, 'user_id' => $this->user->id]); foreach ($images as &$value) { // 查找是否有相同 md5 的文件记录,有的话则只删除记录不删除文件 if (!$this->exists($value)) { @@ -60,7 +60,7 @@ class User extends Base unset($value); } } else { - $image = Images::get($id); + $image = Images::get(['id' => $id, 'user_id' => $this->user->id]); if (!$image) { throw new Exception('没有找到该图片数据'); } @@ -209,7 +209,7 @@ class User extends Base if (!$validate->check(['name' => $name])) { throw new \Exception($validate->getError()); } - if (!Images::where('id', $id)->update(['alias_name' => $name])) { + if (!Images::where('id', $id)->where('user_id', $this->user->user_id)->update(['alias_name' => $name])) { throw new \Exception('重命名失败'); } } catch (\Exception $e) { @@ -232,8 +232,8 @@ class User extends Base private function getDeleteFoldersAndImages($folderId, &$folders, &$images) { - $folderList = Folders::where('parent_id', $folderId)->column('id'); - $imagesList = Images::where('folder_id', $folderId)->column('id'); + $folderList = Folders::where('parent_id', $folderId)->where('user_id', $this->user->id)->column('id'); + $imagesList = Images::where('folder_id', $folderId)->where('user_id', $this->user->id)->column('id'); if ($imagesList) { $images = array_merge($images, $imagesList); }