2020-08-31 01:27:08 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace Snowflake;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use Exception;
|
2020-09-02 18:25:07 +08:00
|
|
|
use HttpServer\Server;
|
2020-08-31 01:27:08 +08:00
|
|
|
use PHPMailer\PHPMailer\PHPMailer;
|
|
|
|
|
use PHPMailer\PHPMailer\SMTP;
|
|
|
|
|
use Snowflake\Abstracts\Component;
|
|
|
|
|
use Swoole\Process\Pool;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Class Processes
|
|
|
|
|
* @package Snowflake
|
|
|
|
|
*/
|
|
|
|
|
class Processes extends Component
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public $processes = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 构建服务
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
public function initCore()
|
|
|
|
|
{
|
2020-09-02 18:25:07 +08:00
|
|
|
/** @var Server $manager */
|
2020-09-02 18:13:16 +08:00
|
|
|
$manager = Snowflake::get()->get('server');
|
2020-08-31 12:38:32 +08:00
|
|
|
|
2020-09-02 11:38:47 +08:00
|
|
|
$serverConfig = Config::get('servers', true);
|
2020-08-31 01:27:08 +08:00
|
|
|
|
2020-09-02 11:38:47 +08:00
|
|
|
return $manager->initCore($serverConfig);
|
2020-08-31 01:27:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @throws Exception
|
|
|
|
|
*/
|
|
|
|
|
public function start()
|
|
|
|
|
{
|
|
|
|
|
$server = $this->initCore();
|
|
|
|
|
$server->start();
|
|
|
|
|
}
|
|
|
|
|
}
|