|
@@ -41,6 +41,13 @@ class SysMenuService extends Service
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if(! empty($msg)){
|
|
|
|
+ foreach ($msg as $button_id){
|
|
|
|
+ SysMenuButton::where('id',$button_id)->update(['del_time' => $time]);
|
|
|
|
+ RoleMenuButton::where('del_time',0)->where('button_id',$button_id)->update(['del_time' => $time]);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
DB::commit();
|
|
DB::commit();
|
|
}catch (\Exception $exception){
|
|
}catch (\Exception $exception){
|
|
DB::rollBack();
|
|
DB::rollBack();
|
|
@@ -162,10 +169,10 @@ class SysMenuService extends Service
|
|
->where('id','<>',$data['id'])
|
|
->where('id','<>',$data['id'])
|
|
->where('del_time',0)
|
|
->where('del_time',0)
|
|
->exists();
|
|
->exists();
|
|
- $role_button = RoleMenuButton::where('del_time',0)
|
|
|
|
|
|
+ $menu_button = SysMenuButton::where('del_time',0)
|
|
->where('menu_id',$data['id'])
|
|
->where('menu_id',$data['id'])
|
|
- ->select('button_id')
|
|
|
|
- ->get()->toArray();
|
|
|
|
|
|
+ ->select('id')->get()->toArray();
|
|
|
|
+ $menu_button = array_column($menu_button,'id');
|
|
}
|
|
}
|
|
if($bool) return [false,'菜单名称已经存在!'];
|
|
if($bool) return [false,'菜单名称已经存在!'];
|
|
|
|
|
|
@@ -181,14 +188,15 @@ class SysMenuService extends Service
|
|
if($title_count[$value] > 1) return [false,'按钮名称不能重复'];
|
|
if($title_count[$value] > 1) return [false,'按钮名称不能重复'];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(! empty($role_button)){
|
|
|
|
|
|
+ $del = [];
|
|
|
|
+ if(! empty($menu_button)){
|
|
$submit = array_column($data['button'],'id');
|
|
$submit = array_column($data['button'],'id');
|
|
- foreach ($role_button as $value){
|
|
|
|
- if(! in_array($value['button_id'],$submit)) return [false,'菜单功能按钮已绑定角色!'];
|
|
|
|
|
|
+ foreach ($menu_button as $value){
|
|
|
|
+ if(! in_array($value,$submit)) $del[] = $value;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- return [true,''];
|
|
|
|
|
|
+ return [true, $del];
|
|
}
|
|
}
|
|
|
|
|
|
public function menuMove($data){
|
|
public function menuMove($data){
|