From a0eb7e01995c1c465a4ac8443fad1f4185e4a6dd Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 10 Nov 2023 09:40:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B7=BB=E5=8A=A0=E6=97=B6?= =?UTF-8?q?=E5=80=99=E7=9A=84=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/adminapi/logic/auth/MenuLogic.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/adminapi/logic/auth/MenuLogic.php b/app/adminapi/logic/auth/MenuLogic.php index c431f663d..90d7cc240 100755 --- a/app/adminapi/logic/auth/MenuLogic.php +++ b/app/adminapi/logic/auth/MenuLogic.php @@ -92,7 +92,22 @@ class MenuLogic extends BaseLogic */ public static function add(array $params) { + $is_pid = true; + $pid=$params['pid']; + $model_name=''; + if ($pid > 0) { + while ($is_pid==true) { + $find= SystemMenu::where('id', $pid)->field('id,pid,paths')->find(); + if($find['pid']==0){ + $is_pid=false; + $model_name=$find['paths']; + }else{ + $pid=$find['pid']; + } + } + } return SystemMenu::create([ + 'model_name' => $model_name, 'pid' => $params['pid'], 'type' => $params['type'], 'name' => $params['name'],