mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-20 23:25:35 +08:00
update to 2.1.6 version
优化代码结构 增加更多提示语 修复处理空格消息时的报错 修复上下文的bug
This commit is contained in:
@@ -55,9 +55,9 @@ class Hello
|
||||
*/
|
||||
public function randNum() {
|
||||
// 获取第一个数字类型的参数
|
||||
$num1 = ctx()->getArgs(ZM_MATCH_NUMBER, "请输入第一个数字");
|
||||
$num1 = ctx()->getNumArg("请输入第一个数字");
|
||||
// 获取第二个数字类型的参数
|
||||
$num2 = ctx()->getArgs(ZM_MATCH_NUMBER, "请输入第二个数字");
|
||||
$num2 = ctx()->getNumArg("请输入第二个数字");
|
||||
$a = min(intval($num1), intval($num2));
|
||||
$b = max(intval($num1), intval($num2));
|
||||
// 回复用户结果
|
||||
|
||||
@@ -74,6 +74,7 @@ class InitCommand extends Command
|
||||
echo("Error occurred. Please check your updates.\n");
|
||||
return Command::FAILURE;
|
||||
}
|
||||
$output->writeln("<info>Done!</info>");
|
||||
return Command::SUCCESS;
|
||||
} elseif (LOAD_MODE === 2) { //从phar启动的框架包,初始化的模式
|
||||
$phar_link = new Phar(__DIR__);
|
||||
|
||||
@@ -75,6 +75,7 @@ class ConsoleApplication extends Application
|
||||
if (!($obj instanceof Command)) throw new TypeError("Command register class must be extended by Symfony\\Component\\Console\\Command\\Command");
|
||||
$this->add($obj);
|
||||
}*/
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -117,6 +117,8 @@ interface ContextInterface
|
||||
|
||||
public function cloneFromParent();
|
||||
|
||||
public function getNumArg($prompt_msg = "");
|
||||
|
||||
public function copy();
|
||||
|
||||
public function getOption();
|
||||
|
||||
@@ -38,7 +38,7 @@ class EventManager
|
||||
public static function registerTimerTick() {
|
||||
$dispatcher = new EventDispatcher(OnTick::class);
|
||||
foreach (self::$events[OnTick::class] ?? [] as $vss) {
|
||||
if (server()->worker_id !== $vss->worker_id) return;
|
||||
if (server()->worker_id !== $vss->worker_id && $vss->worker_id != -1) return;
|
||||
//echo server()->worker_id.PHP_EOL;
|
||||
$plain_class = $vss->class;
|
||||
Console::debug("Added Middleware-based timer: " . $plain_class . " -> " . $vss->method);
|
||||
|
||||
@@ -386,7 +386,7 @@ class ServerEventHandler
|
||||
public function onOpen($server, Request $request) {
|
||||
Console::debug("Calling Swoole \"open\" event from fd=" . $request->fd);
|
||||
unset(Context::$context[Co::getCid()]);
|
||||
$type = strtolower($request->get["type"] ?? $request->header["x-client-role"] ?? "");
|
||||
$type = strtolower($request->header["x-client-role"] ?? $request->get["type"] ?? "");
|
||||
$type_conn = ManagerGM::getTypeClassName($type);
|
||||
ManagerGM::pushConnect($request->fd, $type_conn);
|
||||
$conn = ManagerGM::get($request->fd);
|
||||
|
||||
@@ -78,6 +78,7 @@ class QQBot
|
||||
switch ($data["post_type"]) {
|
||||
case "message":
|
||||
$word = explodeMsg(str_replace("\r", "", context()->getMessage()));
|
||||
if (empty($word)) $word = [""];
|
||||
if (count(explode("\n", $word[0])) >= 2) {
|
||||
$enter = explode("\n", context()->getMessage());
|
||||
$first = split_explode(" ", array_shift($enter));
|
||||
|
||||
Reference in New Issue
Block a user