ComposerUpdate

This commit is contained in:
邹景立 2019-12-06 20:10:17 +08:00
parent bc4f6c101b
commit 8106d73046
12 changed files with 51 additions and 26 deletions

8
composer.lock generated
View File

@ -783,12 +783,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "15fd0b9204728f69861ed7a4c7ba01be1ac4b687" "reference": "e919d8616a5e1497d5bb917d4a39c6ea7c4ccd56"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/15fd0b9204728f69861ed7a4c7ba01be1ac4b687", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/e919d8616a5e1497d5bb917d4a39c6ea7c4ccd56",
"reference": "15fd0b9204728f69861ed7a4c7ba01be1ac4b687", "reference": "e919d8616a5e1497d5bb917d4a39c6ea7c4ccd56",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -832,7 +832,7 @@
], ],
"description": "ThinkPHP v6.0 Development Library", "description": "ThinkPHP v6.0 Development Library",
"homepage": "http://framework.thinkadmin.top", "homepage": "http://framework.thinkadmin.top",
"time": "2019-12-04T12:47:56+00:00" "time": "2019-12-06T09:02:27+00:00"
} }
], ],
"packages-dev": [], "packages-dev": [],

View File

@ -805,12 +805,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "15fd0b9204728f69861ed7a4c7ba01be1ac4b687" "reference": "e919d8616a5e1497d5bb917d4a39c6ea7c4ccd56"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/15fd0b9204728f69861ed7a4c7ba01be1ac4b687", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/e919d8616a5e1497d5bb917d4a39c6ea7c4ccd56",
"reference": "15fd0b9204728f69861ed7a4c7ba01be1ac4b687", "reference": "e919d8616a5e1497d5bb917d4a39c6ea7c4ccd56",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -826,7 +826,7 @@
"ext-json": "*", "ext-json": "*",
"topthink/framework": "^6.0" "topthink/framework": "^6.0"
}, },
"time": "2019-12-04T12:47:56+00:00", "time": "2019-12-06T09:02:27+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"think": { "think": {

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2019-12-04 20:52:46 // This file is automatically generated at:2019-12-06 20:09:37
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\app\\Service', 0 => 'think\\app\\Service',

View File

@ -38,7 +38,9 @@ class Library extends Service
} }
} else { } else {
// 注册会话中间键 // 注册会话中间键
$this->app->middleware->add(SessionInit::class); if ($this->app->request->request('not_init_session', 0) == 0) {
$this->app->middleware->add(SessionInit::class);
}
// 注册访问中间键 // 注册访问中间键
$this->app->middleware->add(function (Request $request, \Closure $next) { $this->app->middleware->add(function (Request $request, \Closure $next) {
$header = []; $header = [];

View File

@ -42,7 +42,7 @@ abstract class Service
} }
/** /**
* 服务初始化 * 初始化服务
* @return $this * @return $this
*/ */
protected function initialize(): Service protected function initialize(): Service

View File

@ -225,3 +225,26 @@ if (!function_exists('format_datetime')) {
} }
} }
} }
if (!function_exists('enbase64url')) {
/**
* Base64安全URL编码
* @param string $string
* @return string
*/
function enbase64url(string $string): string
{
return rtrim(strtr(base64_encode($string), '+/', '-_'), '=');
}
}
if (!function_exists('debase64url')) {
/**
* Base64安全URL解码
* @param string $string
* @return string
*/
function debase64url(string $string): string
{
return base64_decode(str_pad(strtr($string, '-_', '+/'), strlen($string) % 4, '=', STR_PAD_RIGHT));
}
}

View File

@ -36,7 +36,7 @@ class ListenQueue extends Command
} }
/** /**
* 执行进程守护监听 * 启动进程守护监听
* @param Input $input 输入对象 * @param Input $input 输入对象
* @param Output $output 输出对象 * @param Output $output 输出对象
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException

View File

@ -42,8 +42,8 @@ class QueryQueue extends Command
*/ */
protected function execute(Input $input, Output $output) protected function execute(Input $input, Output $output)
{ {
$process = ProcessService::instance(); $service = ProcessService::instance();
$result = $process->query($process->think("xtask:")); $result = $service->query($service->think("xtask:"));
if (count($result) > 0) foreach ($result as $item) { if (count($result) > 0) foreach ($result as $item) {
$output->writeln("{$item['pid']}\t{$item['cmd']}"); $output->writeln("{$item['pid']}\t{$item['cmd']}");
} else { } else {

View File

@ -44,14 +44,14 @@ class StartQueue extends Command
protected function execute(Input $input, Output $output) protected function execute(Input $input, Output $output)
{ {
$this->app->db->name('SystemQueue')->count(); $this->app->db->name('SystemQueue')->count();
$process = ProcessService::instance(); $service = ProcessService::instance();
$command = $process->think("xtask:listen"); $command = $service->think("xtask:listen");
if (count($result = $process->query($command)) > 0) { if (count($result = $service->query($command)) > 0) {
$output->info("监听主进程{$result['0']['pid']}已经启动!"); $output->info("监听主进程{$result['0']['pid']}已经启动!");
} else { } else {
$process->create($command); $service->create($command);
sleep(1); sleep(1);
if (count($result = $process->query($command)) > 0) { if (count($result = $service->query($command)) > 0) {
$output->info("监听主进程{$result['0']['pid']}启动成功!"); $output->info("监听主进程{$result['0']['pid']}启动成功!");
} else { } else {
$output->error('监听主进程创建失败!'); $output->error('监听主进程创建失败!');

View File

@ -42,9 +42,9 @@ class StateQueue extends Command
*/ */
protected function execute(Input $input, Output $output) protected function execute(Input $input, Output $output)
{ {
$process = ProcessService::instance(); $service = ProcessService::instance();
$command = $process->think('xtask:listen'); $command = $service->think('xtask:listen');
if (count($result = $process->query($command)) > 0) { if (count($result = $service->query($command)) > 0) {
$output->info("任务监听主进程{$result[0]['pid']}正在运行..."); $output->info("任务监听主进程{$result[0]['pid']}正在运行...");
} else { } else {
$output->warning("任务监听主进程没有运行哦!"); $output->warning("任务监听主进程没有运行哦!");

View File

@ -43,12 +43,11 @@ class StopQueue extends Command
*/ */
protected function execute(Input $input, Output $output) protected function execute(Input $input, Output $output)
{ {
$process = ProcessService::instance(); $service = ProcessService::instance();
$command = $process->think('xtask:'); if (count($result = $service->query($service->think('xtask:'))) < 1) {
if (count($result = $process->query($command)) < 1) {
$output->warning("没有需要结束的任务进程哦!"); $output->warning("没有需要结束的任务进程哦!");
} else foreach ($result as $item) { } else foreach ($result as $item) {
$process->close($item['pid']); $service->close($item['pid']);
$output->info("发送结束进程{$item['pid']}信号成功!"); $output->info("发送结束进程{$item['pid']}信号成功!");
} }
} }

View File

@ -54,6 +54,7 @@ class WorkQueue extends Command
} }
/** /**
* 执行指令的任务
* @param Input $input 输入对象 * @param Input $input 输入对象
* @param Output $output 输出对象 * @param Output $output 输出对象
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException