This commit is contained in:
2021-08-16 17:23:21 +08:00
parent 93aa4bd23f
commit 01f6491421
3 changed files with 18 additions and 18 deletions
+14 -14
View File
@@ -548,20 +548,20 @@ class Router extends HttpService implements RouterInterface
public function _loader() public function _loader()
{ {
$this->loadRouteDir(APP_PATH . 'routes'); $this->loadRouteDir(APP_PATH . 'routes');
$classes = Kiri::getAnnotation()->runtime(CONTROLLER_PATH); // $classes = Kiri::getAnnotation()->runtime(CONTROLLER_PATH);
//
$di = Kiri::getDi(); // $di = Kiri::getDi();
foreach ($classes as $class) { // foreach ($classes as $class) {
$methods = $di->getMethodAttribute($class); // $methods = $di->getMethodAttribute($class);
foreach ($methods as $method => $attribute) { // foreach ($methods as $method => $attribute) {
if (empty($attribute)) { // if (empty($attribute)) {
continue; // continue;
} // }
foreach ($attribute as $item) { // foreach ($attribute as $item) {
$item->execute($class, $method); // $item->execute($class, $method);
} // }
} // }
} // }
} }
/** /**
+1 -1
View File
@@ -54,7 +54,7 @@ class OnServerWorker extends \Server\Abstracts\Server
$this->eventDispatch->dispatch(new OnWorkerStart($server, $workerId)); $this->eventDispatch->dispatch(new OnWorkerStart($server, $workerId));
$this->workerInitExecutor($server, $annotation, $workerId); $this->workerInitExecutor($server, $annotation, $workerId);
$this->interpretDirectory($annotation); // $this->interpretDirectory($annotation);
$this->eventDispatch->dispatch(new OnAfterWorkerStart()); $this->eventDispatch->dispatch(new OnAfterWorkerStart());
} }
+3 -3
View File
@@ -153,9 +153,9 @@ class Application extends BaseApplication
$manager = Kiri::app()->get('console'); $manager = Kiri::app()->get('console');
$manager->register(Runtime::class); $manager->register(Runtime::class);
$class = $manager->setParameters($argv)->search(); $class = $manager->setParameters($argv)->search();
if (!($class instanceof Command)) { // if (!($class instanceof Command)) {
scan_directory(directory('app'), 'App'); scan_directory(directory('app'), 'App');
} // }
$data = di(Response::class)->getBuilder($manager->execCommand($class)); $data = di(Response::class)->getBuilder($manager->execCommand($class));
} catch (\Throwable $exception) { } catch (\Throwable $exception) {
$data = di(Response::class)->getBuilder(logger()->exception($exception)); $data = di(Response::class)->getBuilder(logger()->exception($exception));