This commit is contained in:
2021-04-08 11:24:31 +08:00
parent 5e4f5d4b6e
commit 0affc404fd
2 changed files with 23 additions and 4 deletions
+6 -2
View File
@@ -10,13 +10,12 @@ declare(strict_types=1);
namespace Snowflake;
use Annotation\Aspect;
use Closure;
use Console\Console;
use Console\ConsoleProviders;
use Database\DatabasesProviders;
use Database\InjectProperty;
use Exception;
use HttpServer\Command;
use HttpServer\ServerProviders;
use Snowflake\Abstracts\BaseApplication;
use Snowflake\Abstracts\Config;
@@ -26,6 +25,7 @@ use Snowflake\Crontab\CrontabProviders;
use Snowflake\Exception\NotFindClassException;
use stdClass;
use Swoole\Timer;
use Wchat\WchatProviders;
/**
* Class Init
@@ -33,6 +33,7 @@ use Swoole\Timer;
* @package Snowflake
*
* @property-read Config $config
* @property-read WchatProviders $wchat
*/
class Application extends BaseApplication
{
@@ -141,6 +142,9 @@ class Application extends BaseApplication
$manager->register(Runtime::class);
$manager->setParameters($argv);
$class = $manager->search();
if (!($class instanceof Command)) {
scan_directory(APP_PATH, 'APP');
}
response()->send($manager->execCommand($class));
} catch (\Throwable $exception) {
response()->send(implode("\n", [
+17 -2
View File
@@ -80,6 +80,22 @@ if (!function_exists('annotation')) {
}
if (!function_exists('scan_directory')) {
/**
* @param $dir
* @param $namespace
* @throws Exception
*/
function scan_directory($dir, $namespace)
{
\annotation()->read($dir, $namespace);
}
}
if (!function_exists('swoole')) {
@@ -312,8 +328,7 @@ if (!function_exists('redis')) {
/**
* @param string $messages
* @param string $category
* @return \Snowflake\Cache\Redis|Redis
* @throws Exception
*/
function redis(): \Snowflake\Cache\Redis|Redis