mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 22:10:49 +00:00
增加批量保存
This commit is contained in:
parent
b4b32a139b
commit
a89d90e81e
@ -97,6 +97,38 @@ class SystemMenus extends AuthController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量保存权限
|
||||
* @return \think\Response
|
||||
* @author 等风来
|
||||
* @email 136327134@qq.com
|
||||
* @date 2023/4/11
|
||||
*/
|
||||
public function batchSave()
|
||||
{
|
||||
$menus = $this->request->post('menus', []);
|
||||
if (!$menus) {
|
||||
return app('json')->fail(100026);
|
||||
}
|
||||
$data = [];
|
||||
|
||||
foreach ($menus as $menu) {
|
||||
if (!empty($menu['menu_name'])) {
|
||||
return app('json')->fail(400198);
|
||||
}
|
||||
$data[] = [
|
||||
'menu_name' => $menu['menu_name'],
|
||||
'unique_auth' => $menu['unique_auth'] ?? '',
|
||||
'api_url' => $menu['api_url'],
|
||||
'path' => implode('/', $data['path']),
|
||||
];
|
||||
}
|
||||
|
||||
$this->services->saveAll($data);
|
||||
|
||||
return app('json')->success(100021);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一条菜单权限信息
|
||||
* @param int $id
|
||||
|
||||
@ -101,7 +101,7 @@ class SystemRouteCate extends AuthController
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return app('json')->success($this->services->getFrom($id));
|
||||
return app('json')->success($this->services->getFrom($id, $this->request->get('app_name', 'adminapi')));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -27,6 +27,8 @@ Route::group('setting', function () {
|
||||
Route::put('update_admin', 'v1.setting.SystemAdmin/update_admin')->name('SystemAdminUpdateAdmin')->option(['real_name' => '修改当前管理员信息']);
|
||||
//设置文件管理密码
|
||||
Route::put('set_file_password', 'v1.setting.SystemAdmin/set_file_password')->name('SystemAdminSetFilePassword')->option(['real_name' => '设置当前文件管理密码']);
|
||||
//批量保存权限
|
||||
Route::post('menus/batch', 'v1.setting.SystemMenus/batchSave')->name('SystemMenusBatchSave')->option(['real_name' => '批量保存权限']);
|
||||
//权限菜单资源路由
|
||||
Route::resource('menus', 'v1.setting.SystemMenus')->option(['real_name' => '权限菜单']);
|
||||
//未添加的权限规则列表
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user