ComposerUpdate

This commit is contained in:
Anyon 2020-05-16 16:51:32 +08:00
parent 4e036d0736
commit 5798240ff5
5 changed files with 15 additions and 13 deletions

8
composer.lock generated
View File

@ -915,12 +915,12 @@
"source": {
"type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "8faeb22f7b2f9a279911b6497de1c6856b368eba"
"reference": "98dce0c32ecde5bdf1e60a3572d8ece6fe828c37"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/8faeb22f7b2f9a279911b6497de1c6856b368eba",
"reference": "8faeb22f7b2f9a279911b6497de1c6856b368eba",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/98dce0c32ecde5bdf1e60a3572d8ece6fe828c37",
"reference": "98dce0c32ecde5bdf1e60a3572d8ece6fe828c37",
"shasum": "",
"mirrors": [
{
@ -964,7 +964,7 @@
],
"description": "ThinkPHP v6.0 Development Library",
"homepage": "http://framework.thinkadmin.top",
"time": "2020-05-15T07:37:07+00:00"
"time": "2020-05-16T08:45:15+00:00"
},
{
"name": "zoujingli/wechat-developer",

View File

@ -941,12 +941,12 @@
"source": {
"type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "8faeb22f7b2f9a279911b6497de1c6856b368eba"
"reference": "98dce0c32ecde5bdf1e60a3572d8ece6fe828c37"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/8faeb22f7b2f9a279911b6497de1c6856b368eba",
"reference": "8faeb22f7b2f9a279911b6497de1c6856b368eba",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/98dce0c32ecde5bdf1e60a3572d8ece6fe828c37",
"reference": "98dce0c32ecde5bdf1e60a3572d8ece6fe828c37",
"shasum": "",
"mirrors": [
{
@ -962,7 +962,7 @@
"ext-json": "*",
"topthink/framework": "^6.0"
},
"time": "2020-05-15T07:37:07+00:00",
"time": "2020-05-16T08:45:15+00:00",
"type": "library",
"extra": {
"think": {

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php
// This file is automatically generated at:2020-05-15 15:40:43
// This file is automatically generated at:2020-05-16 16:51:16
declare (strict_types = 1);
return array (
0 => 'think\\app\\Service',

View File

@ -44,11 +44,13 @@ class Command extends ThinkCommand
* 初始化指令变量
* @param Input $input
* @param Output $output
* @return $this
*/
protected function initialize(Input $input, Output $output)
{
$this->queue = QueueService::instance();
$this->process = ProcessService::instance();
return $this;
}
/**

View File

@ -283,22 +283,22 @@ class Queue extends Command
// 自定义任务,支持返回消息(支持异常结束,异常码可选择 3|4 设置任务状态)
$class = $this->app->make($command, [], true);
if ($class instanceof \think\admin\Queue) {
$this->update(3, $class->initialize($this->queue)->execute($this->queue->data));
$this->updateQueue(3, $class->initialize($this->queue)->execute($this->queue->data));
} elseif ($class instanceof \think\admin\service\QueueService) {
$this->update(3, $class->initialize($this->queue->code)->execute($this->queue->data));
$this->updateQueue(3, $class->initialize($this->queue->code)->execute($this->queue->data));
} else {
throw new \think\admin\Exception("自定义 {$command} 未继承 Queue 或 QueueService");
}
} else {
// 自定义指令,不支持返回消息(支持异常结束,异常码可选择 3|4 设置任务状态)
$attr = explode(' ', trim(preg_replace('|\s+|', ' ', $this->queue->record['command'])));
$this->update(3, $this->app->console->call(array_shift($attr), $attr)->fetch(), false);
$this->updateQueue(3, $this->app->console->call(array_shift($attr), $attr)->fetch(), false);
}
}
} catch (\Exception|\Error $exception) {
$code = $exception->getCode();
if (intval($code) !== 3) $code = 4;
$this->update($code, $exception->getMessage());
$this->updateQueue($code, $exception->getMessage());
}
}