This commit is contained in:
2020-09-10 19:26:42 +08:00
parent 398963606a
commit e5f9e4b078
14 changed files with 569 additions and 4 deletions
+6
View File
@@ -14,10 +14,12 @@ use Console\ConsoleProviders;
use Database\DatabasesProviders;
use Exception;
use HttpServer\ServerProviders;
use Queue\QueueProviders;
use Snowflake\Abstracts\BaseApplication;
use Snowflake\Abstracts\Config;
use Snowflake\Abstracts\Input;
use Snowflake\Exception\NotFindClassException;
use Snowflake\Exception\ConfigException;
use Swoole\Timer;
/**
@@ -37,6 +39,7 @@ class Application extends BaseApplication
/**
* @throws ConfigException
* @throws NotFindClassException
*/
public function init()
@@ -44,6 +47,9 @@ class Application extends BaseApplication
$this->import(ConsoleProviders::class);
$this->import(DatabasesProviders::class);
$this->import(ServerProviders::class);
if (Config::get('queue.enable', false, false)) {
$this->import(QueueProviders::class);
}
}
+1 -1
View File
@@ -142,7 +142,7 @@ class Logger extends Component
/**
* @param $messages
* @param string $category
* @throws Exception
* @throws
*/
public function write(string $messages, $category = 'app')
{
+18
View File
@@ -10,6 +10,7 @@ use ReflectionException;
use Snowflake\Abstracts\Config;
use Snowflake\Di\Container;
use Snowflake\Exception\NotFindClassException;
use Snowflake\Process\Process;
use Swoole\Coroutine;
class Snowflake
@@ -214,6 +215,23 @@ class Snowflake
}
/**
* @param $process
* @return mixed|void
*/
public static function shutdown($process)
{
static::app()->server->getServer()->shutdown();
if ($process instanceof Process) {
$process->exit(0);
}
}
/**
* @param $tmp
* @return string
*/
public static function rename($tmp)
{
$hash = md5_file($tmp['tmp_name']);