mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-31 23:10:45 +00:00
修改获取接口
This commit is contained in:
parent
7d7f63e5bb
commit
a2d51bd87d
@ -121,16 +121,30 @@ class SystemRouteServices extends BaseServices
|
||||
$route = $this->app->route->getRuleList();
|
||||
$action_arr = ['index', 'read', 'create', 'save', 'edit', 'update', 'delete'];
|
||||
|
||||
foreach ($route as &$item) {
|
||||
|
||||
foreach ($route as $key => $item) {
|
||||
$real_name = $item['option']['real_name'] ?? '';
|
||||
if (is_array($real_name)) {
|
||||
foreach ($action_arr as $action) {
|
||||
if (Str::contains($item['route'], $action)) {
|
||||
$real_name = $real_name[$action] ?? '';
|
||||
foreach ($action_arr as $a) {
|
||||
if (Str::contains($item['route'], $a)) {
|
||||
$real_name = $real_name[$a] ?? '';
|
||||
}
|
||||
}
|
||||
}
|
||||
$item['option']['real_name'] = $real_name;
|
||||
$route[$key] = $item;
|
||||
$except = $item['option']['except'] ?? [];
|
||||
|
||||
$router = is_string($item['route']) ? explode('/', $item['route']) : [];
|
||||
$action = $router[count($router) - 1] ?? null;
|
||||
//去除不需要的路由
|
||||
if ($except && $action && in_array($action, $except)) {
|
||||
unset($route[$key]);
|
||||
}
|
||||
$only = $item['option']['only'] ?? [];
|
||||
if ($only && $action && !in_array($action, $only)) {
|
||||
unset($route[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
return $route;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user