This commit is contained in:
walkor 2022-12-09 14:11:26 +08:00
parent 1acd01d9f1
commit 9a0c3dc6d7

View File

@ -239,10 +239,12 @@ class RuleController extends Crud
if (!$row = $this->model->find($id)) { if (!$row = $this->model->find($id)) {
return $this->json(2, '记录不存在'); return $this->json(2, '记录不存在');
} }
if (isset($data['pid'])) {
$data['pid'] = $data['pid'] ?: 0; $data['pid'] = $data['pid'] ?: 0;
if ($data['pid'] == $row['id']) { if ($data['pid'] == $row['id']) {
return $this->json(2, '不能将自己设置为上级菜单'); return $this->json(2, '不能将自己设置为上级菜单');
} }
}
if (isset($data['key'])) { if (isset($data['key'])) {
$data['key'] = str_replace('\\\\', '\\', $data['key']); $data['key'] = str_replace('\\\\', '\\', $data['key']);
} }