mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 14:31:04 +00:00
修改同步路由
This commit is contained in:
parent
9de2754961
commit
948343e294
@ -100,7 +100,7 @@ class SystemRouteServices extends BaseServices
|
||||
|
||||
$route = $this->app->route->getRuleList();
|
||||
$action_arr = ['index', 'read', 'create', 'save', 'edit', 'update', 'delete'];
|
||||
|
||||
|
||||
foreach ($route as &$item) {
|
||||
$real_name = $item['option']['real_name'] ?? '';
|
||||
if (is_array($real_name)) {
|
||||
@ -124,6 +124,16 @@ class SystemRouteServices extends BaseServices
|
||||
*/
|
||||
public function syncRoute(string $app = 'adminapi')
|
||||
{
|
||||
$id = app()->make(SystemRouteCateServices::class)->value(['app_name' => $app, 'name' => '全部权限', 'pid' => 0], 'id');
|
||||
if (!$id) {
|
||||
$res = app()->make(SystemRouteCateServices::class)->save([
|
||||
'app_name' => $app,
|
||||
'name' => '全部权限',
|
||||
'pid' => 0,
|
||||
'add_time' => time(),
|
||||
]);
|
||||
$id = $res->id;
|
||||
}
|
||||
$listAll = $this->getRouteListAll($app);
|
||||
//保持新增的权限路由
|
||||
$data = $this->dao->selectList(['app_name' => $app], 'path,method')->toArray();
|
||||
@ -133,6 +143,7 @@ class SystemRouteServices extends BaseServices
|
||||
$save[] = [
|
||||
'name' => $item['option']['real_name'] ?? $item['name'],
|
||||
'path' => $item['rule'],
|
||||
'cate_id' => $id,
|
||||
'app_name' => $app,
|
||||
'type' => isset($item['option']['is_common']) && $item['option']['is_common'] ? 1 : 0,
|
||||
'method' => $item['method'],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user