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