改名
This commit is contained in:
@@ -469,13 +469,9 @@ class Router extends Application implements RouterInterface
|
|||||||
/**
|
/**
|
||||||
* @throws
|
* @throws
|
||||||
*/
|
*/
|
||||||
public function loader()
|
public function loadRouterSetting()
|
||||||
{
|
{
|
||||||
try {
|
$this->loadRouteDir(APP_PATH . '/routes');
|
||||||
$this->loadDir(APP_PATH . '/routes');
|
|
||||||
} catch (Exception $exception) {
|
|
||||||
$this->error($exception->getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -483,19 +479,22 @@ class Router extends Application implements RouterInterface
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
* 加载目录下的路由文件
|
* 加载目录下的路由文件
|
||||||
*/
|
*/
|
||||||
private function loadDir($path)
|
private function loadRouteDir($path)
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
$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->loadDir($files[$i]);
|
$this->loadRouteDir($files[$i]);
|
||||||
} else {
|
|
||||||
$this->loadFile($files[$i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
$this->loadRouteFile($files[$i]);
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
$this->error($exception->getMessage());
|
$this->error($exception->getMessage());
|
||||||
|
} finally {
|
||||||
|
if (isset($exception)) {
|
||||||
|
unset($exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -504,7 +503,7 @@ class Router extends Application implements RouterInterface
|
|||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function loadFile($file)
|
private function loadRouteFile($file)
|
||||||
{
|
{
|
||||||
$router = $this;
|
$router = $this;
|
||||||
|
|
||||||
@@ -512,7 +511,7 @@ class Router extends Application implements RouterInterface
|
|||||||
|
|
||||||
/** @var Annotation $annotation */
|
/** @var Annotation $annotation */
|
||||||
$annotation = Snowflake::get()->annotation;
|
$annotation = Snowflake::get()->annotation;
|
||||||
$annotation->register('http',Annotation::class);
|
$annotation->register('http', Annotation::class);
|
||||||
|
|
||||||
$annotation = $annotation->get('http');
|
$annotation = $annotation->get('http');
|
||||||
$annotation->registration_notes($prefix . 'Interceptor', 'App\Http\Interceptor');
|
$annotation->registration_notes($prefix . 'Interceptor', 'App\Http\Interceptor');
|
||||||
|
|||||||
Reference in New Issue
Block a user