Compare commits

...

11 Commits
main ... 2.8.1

Author SHA1 Message Date
crazywhalecc
47cca37854 update docs 2022-07-03 14:12:04 +08:00
Github Build Bot
0fa49171b9 increment build number (build 475) 2022-07-03 05:14:16 +00:00
Github Build Bot
ea1d14ba00 update api docs 2022-07-03 05:14:15 +00:00
crazywhalecc
a01791ddbe Fix phpstan strict compare problem for STDIN 2022-07-03 13:13:29 +08:00
crazywhalecc
51a9c5c4e8 update version name to 2.8.1 2022-07-03 13:13:29 +08:00
crazywhalecc
b1e37943df fix bug #136 2022-07-03 13:13:29 +08:00
crazywhalecc
5459d1c5ff add @OnSave annotation docs 2022-06-14 13:30:35 +08:00
Jerry Ma
21373097bb Update route-annotations.md 2022-06-14 11:42:40 +08:00
Github Build Bot
f4f7327695 increment build number (build 474) 2022-05-21 09:42:07 +00:00
Github Build Bot
36fc2cb4cd update api docs 2022-05-21 09:42:06 +00:00
sunxyw
b7469b9dd4 tmp fix close connection binding warning (#128) 2022-05-21 17:40:43 +08:00
10 changed files with 56 additions and 12 deletions

View File

@@ -72,7 +72,10 @@
],
"config": {
"optimize-autoloader": true,
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"phpstan/extension-installer": true
}
},
"extra": {
"hooks": {

View File

@@ -1 +1 @@
module.exports = [{"title":"ZM","collapsable":true,"children":["ZM/ZMServer"]},{"title":"ZM/API","collapsable":true,"children":["ZM/API/CQ","ZM/API/OneBotV11","ZM/API/ZMRobot","ZM/API/GoCqhttpAPIV11","ZM/API/TuringAPI"]},{"title":"ZM/API/Proxies/Bot","collapsable":true,"children":["ZM/API/Proxies/Bot/AllBotsProxy","ZM/API/Proxies/Bot/AllGroupsProxy","ZM/API/Proxies/Bot/AbstractBotProxy"]},{"title":"ZM/Annotation/Swoole","collapsable":true,"children":["ZM/Annotation/Swoole/OnSwooleEventBase"]},{"title":"ZM/Command","collapsable":true,"children":["ZM/Command/CheckConfigCommand"]},{"title":"ZM/Command/Module","collapsable":true,"children":["ZM/Command/Module/ModuleListCommand","ZM/Command/Module/ModulePackCommand"]},{"title":"ZM/Container","collapsable":true,"children":["ZM/Container/Container","ZM/Container/BoundMethod","ZM/Container/WorkerContainer"]},{"title":"ZM/DB","collapsable":true,"children":["ZM/DB/InsertBody","ZM/DB/Table","ZM/DB/DB","ZM/DB/DeleteBody","ZM/DB/SelectBody","ZM/DB/UpdateBody"]},{"title":"ZM/Event","collapsable":true,"children":["ZM/Event/EventTracer","ZM/Event/EventManager","ZM/Event/EventDispatcher"]},{"title":"ZM/Event/SwooleEvent","collapsable":true,"children":["ZM/Event/SwooleEvent/OnMessage","ZM/Event/SwooleEvent/OnTask"]},{"title":"ZM/Http","collapsable":true,"children":["ZM/Http/Response"]},{"title":"ZM/Module","collapsable":true,"children":["ZM/Module/ModuleUnpacker","ZM/Module/ModulePacker","ZM/Module/ModuleBase"]},{"title":"ZM/MySQL","collapsable":true,"children":["ZM/MySQL/MySQLQueryBuilder","ZM/MySQL/MySQLPool","ZM/MySQL/MySQLStatementWrapper","ZM/MySQL/MySQLStatement","ZM/MySQL/MySQLWrapper","ZM/MySQL/MySQLConnection"]},{"title":"ZM/Store","collapsable":true,"children":["ZM/Store/ZMAtomic","ZM/Store/LightCacheInside","ZM/Store/LightCache"]},{"title":"ZM/Store/Redis","collapsable":true,"children":["ZM/Store/Redis/ZMRedis"]},{"title":"ZM/Utils","collapsable":true,"children":["ZM/Utils/SignalListener","ZM/Utils/CoMessage","ZM/Utils/Terminal","ZM/Utils/MessageUtil","ZM/Utils/DataProvider","ZM/Utils/HttpUtil","ZM/Utils/ReflectionUtil","ZM/Utils/CommandInfoUtil"]},{"title":"ZM/Utils/Manager","collapsable":true,"children":["ZM/Utils/Manager/WorkerManager","ZM/Utils/Manager/ModuleManager","ZM/Utils/Manager/CronManager"]}]
module.exports = [{"title":"ZM","collapsable":true,"children":["ZM/ZMServer"]},{"title":"ZM/API","collapsable":true,"children":["ZM/API/GoCqhttpAPIV11","ZM/API/TuringAPI","ZM/API/OneBotV11","ZM/API/ZMRobot","ZM/API/CQ"]},{"title":"ZM/API/Proxies/Bot","collapsable":true,"children":["ZM/API/Proxies/Bot/AbstractBotProxy","ZM/API/Proxies/Bot/AllGroupsProxy","ZM/API/Proxies/Bot/AllBotsProxy"]},{"title":"ZM/Annotation/Swoole","collapsable":true,"children":["ZM/Annotation/Swoole/OnSwooleEventBase"]},{"title":"ZM/Command","collapsable":true,"children":["ZM/Command/CheckConfigCommand"]},{"title":"ZM/Command/Module","collapsable":true,"children":["ZM/Command/Module/ModulePackCommand","ZM/Command/Module/ModuleListCommand"]},{"title":"ZM/Container","collapsable":true,"children":["ZM/Container/WorkerContainer","ZM/Container/Container","ZM/Container/BoundMethod"]},{"title":"ZM/DB","collapsable":true,"children":["ZM/DB/SelectBody","ZM/DB/InsertBody","ZM/DB/Table","ZM/DB/DB","ZM/DB/UpdateBody","ZM/DB/DeleteBody"]},{"title":"ZM/Event","collapsable":true,"children":["ZM/Event/EventTracer","ZM/Event/EventDispatcher","ZM/Event/EventManager"]},{"title":"ZM/Event/SwooleEvent","collapsable":true,"children":["ZM/Event/SwooleEvent/OnMessage","ZM/Event/SwooleEvent/OnTask"]},{"title":"ZM/Http","collapsable":true,"children":["ZM/Http/Response"]},{"title":"ZM/Module","collapsable":true,"children":["ZM/Module/ModulePacker","ZM/Module/ModuleUnpacker","ZM/Module/ModuleBase"]},{"title":"ZM/MySQL","collapsable":true,"children":["ZM/MySQL/MySQLConnection","ZM/MySQL/MySQLStatement","ZM/MySQL/MySQLWrapper","ZM/MySQL/MySQLPool","ZM/MySQL/MySQLQueryBuilder","ZM/MySQL/MySQLStatementWrapper"]},{"title":"ZM/Store","collapsable":true,"children":["ZM/Store/ZMAtomic","ZM/Store/LightCache","ZM/Store/LightCacheInside"]},{"title":"ZM/Store/Redis","collapsable":true,"children":["ZM/Store/Redis/ZMRedis"]},{"title":"ZM/Utils","collapsable":true,"children":["ZM/Utils/SignalListener","ZM/Utils/MessageUtil","ZM/Utils/CommandInfoUtil","ZM/Utils/ReflectionUtil","ZM/Utils/Terminal","ZM/Utils/CoMessage","ZM/Utils/DataProvider","ZM/Utils/HttpUtil"]},{"title":"ZM/Utils/Manager","collapsable":true,"children":["ZM/Utils/Manager/WorkerManager","ZM/Utils/Manager/CronManager","ZM/Utils/Manager/ModuleManager"]}]

View File

@@ -262,6 +262,22 @@
无。
## OnSave()
框架退出和每 15 分钟在 Worker #0 执行的代码。建议这里用来编写内存数据持久化的代码,如将 WorkerCache、内存全局变量存到文件。
| 类型 | 值 |
| ---------- | ------------------------------ |
| 名称 | `@OnSetup` |
| 触发前提 | 每 15 分钟或 Ctrl+C、`server:stop` 等方式退出框架时 |
| 命名空间 | `ZM\Annotation\Swoole\OnSave` |
| 适用位置 | 方法 |
| 返回值处理 | 无 |
### 注解参数
无。
## TerminalCommand()
添加一个远程终端的自定义命令。2.4.0 版本起可用)
@@ -430,4 +446,4 @@ public function onCrawl() {
## 示例6创建一个远程终端命令并调试框架
> 开个坑以后填。__填坑标记__
>
>

View File

@@ -177,7 +177,13 @@ public function testUrl() {
如果想要设置允许请求控制器的 HTTP 请求方式,可以使用方法在控制器中的 `@RequestMapping` 注解配置 `method` 参数,可以是 `GET``POST``PUT`, `PATCH``DELETE``OPTIONS``HEAD` 中的一个或多个。
- 限定 HTTP 方法:`@RequestMapping(method="GET")``@RequestMapping(method={"GET","POST"})`
- 限定 HTTP 方法:`@RequestMapping(request_method="GET")``@RequestMapping(request_method={"GET","POST"})`
::: warning 注意
此处是 `request_method`,而不是 `method`,因为炸毛框架的注解 `method` 是保留属性,写错会出现问题。
:::
## 静态文件服务器

View File

@@ -4,6 +4,14 @@
同时此处将只使用 build 版本号进行区分。
## build 475 (2022-7-3)
- 修复 `match_args` 全局方法对于 `0` 字符串处理的 Bug#136
## build 474 (2022-5-21)
- 修复 WebSocket 连接时报错的 Bug
## build 473 (2022-5-7)
- 修复 `server:stop` 命令下部分情况报错的问题

View File

@@ -1,5 +1,12 @@
# 更新日志v2 版本)
## v2.8.1build 475
> 更新时间2022.7.3
- 修复 WebSocket 连接时报错的 Bug
- 修复 `match_args` 全局方法对于 `0` 字符串处理的 Bug#136
## v2.8.0build 473
> 更新时间2022.5.7

View File

@@ -28,9 +28,9 @@ use ZM\Exception\InitException;
class ConsoleApplication extends Application
{
public const VERSION_ID = 473;
public const VERSION_ID = 475;
public const VERSION = '2.8.0';
public const VERSION = '2.8.1';
private static $obj;

View File

@@ -11,6 +11,7 @@ use ZM\Annotation\Swoole\OnCloseEvent;
use ZM\Annotation\Swoole\OnSwooleEvent;
use ZM\Annotation\Swoole\SwooleHandler;
use ZM\Config\ZMConfig;
use ZM\ConnectionManager\ConnectionObject;
use ZM\ConnectionManager\ManagerGM;
use ZM\Console\Console;
use ZM\Context\Context;
@@ -34,6 +35,8 @@ class OnClose implements SwooleEvent
}
set_coroutine_params(['server' => $server, 'connection' => $conn, 'fd' => $fd]);
container()->instance(ConnectionObject::class, $conn);
$dispatcher1 = new EventDispatcher(OnCloseEvent::class);
$dispatcher1->setRuleFunction(function ($v) {
return $v->connect_type == ctx()->getConnection()->getName() && eval('return ' . $v->getRule() . ';');

View File

@@ -197,12 +197,13 @@ class ModuleUnpacker
$prompt = !is_string($this->module['unpack']['global-config-override']) ? '请根据模块提供者提供的要求进行修改 global.php 中对应的配置项' : $this->module['unpack']['global-config-override'];
Console::warning('模块作者要求用户手动修改 global.php 配置文件中的项目:');
Console::warning('*' . $prompt);
if (STDIN === false) {
echo Console::setColor('请输入修改模式y(使用vim修改)/e(自行使用其他编辑器修改后确认)/N(默认暂不修改)[y/e/N] ', 'gold');
$gets = fgets(STDIN);
if ($gets === false) {
Console::warning('检测到终端无法输入,请手动修改 global.php 配置文件中的项目');
return;
}
echo Console::setColor('请输入修改模式y(使用vim修改)/e(自行使用其他编辑器修改后确认)/N(默认暂不修改)[y/e/N] ', 'gold');
$r = strtolower(trim(fgets(STDIN)));
$r = strtolower(trim($gets));
switch ($r) {
case 'y':
system('vim ' . escapeshellarg(DataProvider::getWorkingDir() . '/config/global.php') . ' > `tty`');

View File

@@ -156,16 +156,16 @@ function match_args(string $pattern, string $subject)
$exp = explode('*', $pattern);
$i = 0;
foreach ($exp as $k => $v) {
if (empty($v) && $k === 0) {
if ($v === '' && $k === 0) {
continue;
}
if (empty($v) && $k === count($exp) - 1) {
if ($v === '' && $k === count($exp) - 1) {
$subject .= '^EOL';
$v = '^EOL';
}
$cur_var = '';
$ori = $i;
while (($a = mb_substr($subject, $i, mb_strlen($v))) !== $v && !empty($a)) {
while (($a = mb_substr($subject, $i, mb_strlen($v))) !== $v && $a !== '') {
$cur_var .= mb_substr($subject, $i, 1);
++$i;
}