mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-23 08:35:35 +08:00
fix issue #15 at version 1.6.2
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
"description": "High performance QQ robot and web server development framework",
|
"description": "High performance QQ robot and web server development framework",
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"version": "1.6.1",
|
"version": "1.6.2",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "whale",
|
"name": "whale",
|
||||||
|
|||||||
@@ -8,23 +8,23 @@ $config['host'] = '0.0.0.0';
|
|||||||
$config['port'] = 20001;
|
$config['port'] = 20001;
|
||||||
|
|
||||||
/** 框架开到公网或外部的HTTP访问链接,通过 DataProvider::getFrameworkLink() 获取 */
|
/** 框架开到公网或外部的HTTP访问链接,通过 DataProvider::getFrameworkLink() 获取 */
|
||||||
$config['http_reverse_link'] = "http://127.0.0.1:".$config['port'];
|
$config['http_reverse_link'] = "http://127.0.0.1:" . $config['port'];
|
||||||
|
|
||||||
/** 框架是否启动debug模式 */
|
/** 框架是否启动debug模式 */
|
||||||
$config['debug_mode'] = false;
|
$config['debug_mode'] = false;
|
||||||
|
|
||||||
/** 存放框架内文件数据的目录 */
|
/** 存放框架内文件数据的目录 */
|
||||||
$config['zm_data'] = realpath(__DIR__ . "/../").'/zm_data/';
|
$config['zm_data'] = realpath(__DIR__ . "/../") . '/zm_data/';
|
||||||
|
|
||||||
/** 存放各个模块配置文件的目录 */
|
/** 存放各个模块配置文件的目录 */
|
||||||
$config['config_dir'] = $config['zm_data'].'config/';
|
$config['config_dir'] = $config['zm_data'] . 'config/';
|
||||||
|
|
||||||
/** 存放崩溃和运行日志的目录 */
|
/** 存放崩溃和运行日志的目录 */
|
||||||
$config['crash_dir'] = $config['zm_data'].'crash/';
|
$config['crash_dir'] = $config['zm_data'] . 'crash/';
|
||||||
|
|
||||||
/** 对应swoole的server->set参数 */
|
/** 对应swoole的server->set参数 */
|
||||||
$config['swoole'] = [
|
$config['swoole'] = [
|
||||||
'log_file' => $config['crash_dir'].'swoole_error.log',
|
'log_file' => $config['crash_dir'] . 'swoole_error.log',
|
||||||
'worker_num' => 1,
|
'worker_num' => 1,
|
||||||
'dispatch_mode' => 2,
|
'dispatch_mode' => 2,
|
||||||
//'task_worker_num' => 1,
|
//'task_worker_num' => 1,
|
||||||
@@ -88,7 +88,7 @@ $config['static_file_server'] = [
|
|||||||
|
|
||||||
/** 注册 Swoole Server 事件注解的类列表 */
|
/** 注册 Swoole Server 事件注解的类列表 */
|
||||||
$config['server_event_handler_class'] = [
|
$config['server_event_handler_class'] = [
|
||||||
\Framework\ServerEventHandler::class, //默认不可删除,否则会不能使用框架
|
\Framework\ServerEventHandler::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
|
|||||||
@@ -76,7 +76,10 @@ class FrameworkLoader
|
|||||||
self::$argv[] = "--disable-console-input";
|
self::$argv[] = "--disable-console-input";
|
||||||
}
|
}
|
||||||
$this->server->set($settings);
|
$this->server->set($settings);
|
||||||
$all_event_class = self::$settings->get("server_event_handler_class");
|
$all_event_class = self::$settings->get("server_event_handler_class") ?? [];
|
||||||
|
if (!in_array(ServerEventHandler::class, $all_event_class)) {
|
||||||
|
$all_event_class[] = ServerEventHandler::class;
|
||||||
|
}
|
||||||
$event_list = [];
|
$event_list = [];
|
||||||
foreach ($all_event_class as $v) {
|
foreach ($all_event_class as $v) {
|
||||||
$reader = new AnnotationReader();
|
$reader = new AnnotationReader();
|
||||||
@@ -125,15 +128,6 @@ class FrameworkLoader
|
|||||||
}
|
}
|
||||||
if (in_array("--debug-mode", self::$argv))
|
if (in_array("--debug-mode", self::$argv))
|
||||||
Console::warning("You are in debug mode, do not use in production!");
|
Console::warning("You are in debug mode, do not use in production!");
|
||||||
register_shutdown_function(function() {
|
|
||||||
$error = error_get_last();
|
|
||||||
if(isset($error["type"]) && $error["type"] == 1) {
|
|
||||||
if(mb_strpos($error["message"], "require") !== false && mb_strpos($error["message"], "callback") !== false) {
|
|
||||||
echo "\e[38;5;203mYou may need to update your \"global.php\" config!\n";
|
|
||||||
echo "Please see: https://github.com/zhamao-robot/zhamao-framework/issues/15\e[m\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
$this->server->start();
|
$this->server->start();
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
Console::error("Framework初始化出现错误,请检查!");
|
Console::error("Framework初始化出现错误,请检查!");
|
||||||
@@ -177,7 +171,6 @@ class FrameworkLoader
|
|||||||
//if (!file_exists(CRASH_DIR . "last_error.log")) die("Can not find log file.\n");
|
//if (!file_exists(CRASH_DIR . "last_error.log")) die("Can not find log file.\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
global $motd;
|
global $motd;
|
||||||
|
|||||||
Reference in New Issue
Block a user