修复添加时候的错误

This commit is contained in:
mkm 2023-11-10 09:40:41 +08:00
parent 681fc5159b
commit a0eb7e0199

View File

@ -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'],