From 948343e294e2ed05e0e6ee441d0278492ba99a6a Mon Sep 17 00:00:00 2001 From: liaofei <136327134@qq.com> Date: Mon, 10 Apr 2023 09:39:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8C=E6=AD=A5=E8=B7=AF?= =?UTF-8?q?=E7=94=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/services/system/SystemRouteServices.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crmeb/app/services/system/SystemRouteServices.php b/crmeb/app/services/system/SystemRouteServices.php index 41a82d8cd..2d0fb0339 100644 --- a/crmeb/app/services/system/SystemRouteServices.php +++ b/crmeb/app/services/system/SystemRouteServices.php @@ -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'],