mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-10 10:15:35 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
517d258d61 |
@@ -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": "2.2.2",
|
"version": "2.2.3",
|
||||||
"extra": {
|
"extra": {
|
||||||
"exclude_annotate": [
|
"exclude_annotate": [
|
||||||
"src/ZM"
|
"src/ZM"
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
# 更新日志(v2 版本)
|
# 更新日志(v2 版本)
|
||||||
|
|
||||||
|
## v2.2.3
|
||||||
|
|
||||||
|
> 更新时间:2021.1.30
|
||||||
|
|
||||||
|
- 修复:waitMessage() 在 v2.2.2 版本中不可用的 bug
|
||||||
|
- 修复:access_token 无效的问题
|
||||||
|
|
||||||
## v2.2.2
|
## v2.2.2
|
||||||
|
|
||||||
> 更新时间:2021.1.29
|
> 更新时间:2021.1.29
|
||||||
|
|||||||
@@ -401,6 +401,14 @@ class ServerEventHandler
|
|||||||
Console::debug("Calling Swoole \"open\" event from fd=" . $request->fd);
|
Console::debug("Calling Swoole \"open\" event from fd=" . $request->fd);
|
||||||
unset(Context::$context[Co::getCid()]);
|
unset(Context::$context[Co::getCid()]);
|
||||||
$type = strtolower($request->header["x-client-role"] ?? $request->get["type"] ?? "");
|
$type = strtolower($request->header["x-client-role"] ?? $request->get["type"] ?? "");
|
||||||
|
$access_token = explode(" ", $request->header["authorization"] ?? $request->get["token"] ?? "")[1] ?? "";
|
||||||
|
if (($a = ZMConfig::get("global", "access_token")) != "") {
|
||||||
|
if ($access_token !== $a) {
|
||||||
|
$server->close($request->fd);
|
||||||
|
Console::warning("Unauthorized access_token: ".$access_token);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
$type_conn = ManagerGM::getTypeClassName($type);
|
$type_conn = ManagerGM::getTypeClassName($type);
|
||||||
ManagerGM::pushConnect($request->fd, $type_conn);
|
ManagerGM::pushConnect($request->fd, $type_conn);
|
||||||
$conn = ManagerGM::get($request->fd);
|
$conn = ManagerGM::get($request->fd);
|
||||||
|
|||||||
@@ -30,11 +30,6 @@ class QQBot
|
|||||||
try {
|
try {
|
||||||
$data = json_decode(context()->getFrame()->data, true);
|
$data = json_decode(context()->getFrame()->data, true);
|
||||||
set_coroutine_params(["data" => $data]);
|
set_coroutine_params(["data" => $data]);
|
||||||
if (isset($data["echo"])) {
|
|
||||||
if (CoMessage::resumeByWS()) {
|
|
||||||
EventDispatcher::interrupt();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isset($data["post_type"])) {
|
if (isset($data["post_type"])) {
|
||||||
//echo TermColor::ITALIC.json_encode($data, 128|256).TermColor::RESET.PHP_EOL;
|
//echo TermColor::ITALIC.json_encode($data, 128|256).TermColor::RESET.PHP_EOL;
|
||||||
ctx()->setCache("level", 0);
|
ctx()->setCache("level", 0);
|
||||||
@@ -44,10 +39,12 @@ class QQBot
|
|||||||
if ($r->store === "block") EventDispatcher::interrupt();
|
if ($r->store === "block") EventDispatcher::interrupt();
|
||||||
}
|
}
|
||||||
//Console::warning("最上数据包:".json_encode($data));
|
//Console::warning("最上数据包:".json_encode($data));
|
||||||
$this->dispatchEvents($data);
|
|
||||||
} else {
|
|
||||||
$this->dispatchAPIResponse($data);
|
|
||||||
}
|
}
|
||||||
|
if (isset($data["echo"]) || isset($data["post_type"])) {
|
||||||
|
if (CoMessage::resumeByWS()) EventDispatcher::interrupt();
|
||||||
|
}
|
||||||
|
if (isset($data["post_type"])) $this->dispatchEvents($data);
|
||||||
|
else $this->dispatchAPIResponse($data);
|
||||||
} /** @noinspection PhpRedundantCatchClauseInspection */ catch (WaitTimeoutException $e) {
|
} /** @noinspection PhpRedundantCatchClauseInspection */ catch (WaitTimeoutException $e) {
|
||||||
$e->module->finalReply($e->getMessage());
|
$e->module->finalReply($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user