改名
This commit is contained in:
@@ -70,7 +70,7 @@ class Middleware
|
||||
return $middleWares;
|
||||
}
|
||||
foreach ($node->getInterceptor() as $item) {
|
||||
$middleWares[] = $item;
|
||||
$middleWares[] = $item[0];
|
||||
}
|
||||
return $middleWares;
|
||||
}
|
||||
|
||||
@@ -481,7 +481,6 @@ class Router extends Application implements RouterInterface
|
||||
$annotation->registration_notes($prefix . 'Interceptor', 'App\Http\Interceptor');
|
||||
$annotation->registration_notes($prefix . 'Limits', 'App\Http\Limits');
|
||||
|
||||
$router = $this;
|
||||
$this->loadRouteDir(APP_PATH . '/routes');
|
||||
}
|
||||
|
||||
@@ -494,19 +493,31 @@ class Router extends Application implements RouterInterface
|
||||
{
|
||||
$files = glob($path . '/*');
|
||||
for ($i = 0; $i < count($files); $i++) {
|
||||
try {
|
||||
if (is_dir($files[$i])) {
|
||||
$this->loadRouteDir($files[$i]);
|
||||
} else {
|
||||
include_once "{$files[$i]}";
|
||||
}
|
||||
} catch (Exception $exception) {
|
||||
$this->error($exception->getMessage());
|
||||
} finally {
|
||||
if (isset($exception)) {
|
||||
unset($exception);
|
||||
}
|
||||
if (is_dir($files[$i])) {
|
||||
$this->loadRouteDir($files[$i]);
|
||||
} else {
|
||||
$this->loadRouterFile($files[$i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $files
|
||||
* @throws Exception
|
||||
*/
|
||||
private function loadRouterFile($files)
|
||||
{
|
||||
try {
|
||||
$router = $this;
|
||||
include_once "{$files}";
|
||||
} catch (Exception $exception) {
|
||||
$this->error($exception->getMessage());
|
||||
} finally {
|
||||
if (isset($exception)) {
|
||||
unset($exception);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ return [
|
||||
'events' => [
|
||||
Event::SERVER_WORKER_START => function () {
|
||||
$router = Snowflake::get()->router;
|
||||
$router->loader();
|
||||
$router->loadRouterSetting();
|
||||
},
|
||||
]
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user