mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-24 17:15:36 +08:00
fix instant mode related files
This commit is contained in:
@@ -9,23 +9,32 @@ namespace ZM\Module;
|
|||||||
*/
|
*/
|
||||||
abstract class ModuleBase
|
abstract class ModuleBase
|
||||||
{
|
{
|
||||||
|
/** @var string 模块名称 */
|
||||||
protected $module_name;
|
protected $module_name;
|
||||||
|
|
||||||
|
/** @var array 事件列表 */
|
||||||
protected $events = [];
|
protected $events = [];
|
||||||
|
|
||||||
public function __construct($module_name)
|
/**
|
||||||
|
* @param string $module_name 模块名称
|
||||||
|
*/
|
||||||
|
public function __construct(string $module_name)
|
||||||
{
|
{
|
||||||
$this->module_name = $module_name;
|
$this->module_name = $module_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return mixed
|
* 获取模块名称
|
||||||
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getModuleName()
|
public function getModuleName()
|
||||||
{
|
{
|
||||||
return $this->module_name;
|
return $this->module_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取事件列表
|
||||||
|
*/
|
||||||
public function getEvents(): array
|
public function getEvents(): array
|
||||||
{
|
{
|
||||||
return $this->events;
|
return $this->events;
|
||||||
|
|||||||
@@ -15,21 +15,31 @@ use ZM\Module\ModuleBase;
|
|||||||
*/
|
*/
|
||||||
class ZMServer
|
class ZMServer
|
||||||
{
|
{
|
||||||
|
/** @var string App名称 */
|
||||||
protected $app_name;
|
protected $app_name;
|
||||||
|
|
||||||
/** @var ModuleBase[] */
|
/** @var ModuleBase[] */
|
||||||
protected $modules = [];
|
protected $modules = [];
|
||||||
|
|
||||||
public function __construct($app_name)
|
/**
|
||||||
|
* @param string $app_name App名称
|
||||||
|
*/
|
||||||
|
public function __construct(string $app_name)
|
||||||
{
|
{
|
||||||
$this->app_name = $app_name;
|
$this->app_name = $app_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $module_class
|
||||||
|
*/
|
||||||
public function addModule($module_class)
|
public function addModule($module_class)
|
||||||
{
|
{
|
||||||
$this->modules[] = $module_class;
|
$this->modules[] = $module_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws InitException
|
||||||
|
*/
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
Console::setLevel(4);
|
Console::setLevel(4);
|
||||||
@@ -39,7 +49,7 @@ class ZMServer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo "Running...\n";
|
echo "Running...\n";
|
||||||
if (defined('WORKDING_DIR')) {
|
if (defined('WORKING_DIR')) {
|
||||||
throw new InitException();
|
throw new InitException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,10 +67,7 @@ class ZMServer
|
|||||||
(new Framework($options, true))->start();
|
(new Framework($options, true))->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getAppName(): string
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getAppName()
|
|
||||||
{
|
{
|
||||||
return $this->app_name;
|
return $this->app_name;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user