mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2026-06-08 04:48:10 +08:00
fix: 修改文件注释,格式化代码
This commit is contained in:
parent
1c70a78c74
commit
6067f9778b
@ -34,8 +34,21 @@ abstract class Server
|
|||||||
protected $port = '2346';
|
protected $port = '2346';
|
||||||
protected $option = [];
|
protected $option = [];
|
||||||
protected $context = [];
|
protected $context = [];
|
||||||
protected $event = ['onWorkerStart', 'onConnect', 'onMessage', 'onClose', 'onError', 'onBufferFull', 'onBufferDrain', 'onWorkerReload', 'onWebSocketConnect'];
|
protected $event = [
|
||||||
|
'onWorkerStart',
|
||||||
|
'onConnect',
|
||||||
|
'onMessage',
|
||||||
|
'onClose',
|
||||||
|
'onError',
|
||||||
|
'onBufferFull',
|
||||||
|
'onBufferDrain',
|
||||||
|
'onWorkerReload',
|
||||||
|
'onWebSocketConnect'
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务构造方法
|
||||||
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
// 实例化 Websocket 服务
|
// 实例化 Websocket 服务
|
||||||
@ -59,13 +72,29 @@ abstract class Server
|
|||||||
$this->init();
|
$this->init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务初始化方法
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
abstract protected function init();
|
abstract protected function init();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态设置属性
|
||||||
|
* @param string $name
|
||||||
|
* @param mixed $value
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function __set(string $name, $value)
|
public function __set(string $name, $value)
|
||||||
{
|
{
|
||||||
$this->worker->$name = $value;
|
$this->worker->$name = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态调用方法
|
||||||
|
* @param string $method
|
||||||
|
* @param array $args
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
public function __call(string $method, array $args)
|
public function __call(string $method, array $args)
|
||||||
{
|
{
|
||||||
call_user_func_array([$this->worker, $method], $args);
|
call_user_func_array([$this->worker, $method], $args);
|
||||||
|
|||||||
@ -21,6 +21,11 @@ namespace plugin\worker;
|
|||||||
use plugin\worker\command\Worker;
|
use plugin\worker\command\Worker;
|
||||||
use think\admin\Plugin;
|
use think\admin\Plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插件注册服务
|
||||||
|
* @class Service
|
||||||
|
* @package plugin\worker
|
||||||
|
*/
|
||||||
class Service extends Plugin
|
class Service extends Plugin
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user