From 9a0c3dc6d75f6a440619a659abbeb7c3433c132d Mon Sep 17 00:00:00 2001 From: walkor Date: Fri, 9 Dec 2022 14:11:26 +0800 Subject: [PATCH] save --- src/plugin/admin/app/controller/RuleController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugin/admin/app/controller/RuleController.php b/src/plugin/admin/app/controller/RuleController.php index 678eb99..e94deba 100644 --- a/src/plugin/admin/app/controller/RuleController.php +++ b/src/plugin/admin/app/controller/RuleController.php @@ -239,9 +239,11 @@ class RuleController extends Crud if (!$row = $this->model->find($id)) { return $this->json(2, '记录不存在'); } - $data['pid'] = $data['pid'] ?: 0; - if ($data['pid'] == $row['id']) { - return $this->json(2, '不能将自己设置为上级菜单'); + if (isset($data['pid'])) { + $data['pid'] = $data['pid'] ?: 0; + if ($data['pid'] == $row['id']) { + return $this->json(2, '不能将自己设置为上级菜单'); + } } if (isset($data['key'])) { $data['key'] = str_replace('\\\\', '\\', $data['key']);