From 9a14e8dbe5a575c10d6e38b7e01c2df188bc36a9 Mon Sep 17 00:00:00 2001 From: Anyon Date: Mon, 2 Dec 2019 10:51:37 +0800 Subject: [PATCH] ComposerUpdate --- composer.lock | 20 ++--- vendor/composer/installed.json | 22 +++--- vendor/opis/closure/CHANGELOG.md | 13 +++ vendor/opis/closure/README.md | 2 +- vendor/opis/closure/composer.json | 2 +- vendor/opis/closure/src/ClosureStream.php | 5 ++ vendor/opis/closure/src/ReflectionClosure.php | 79 ++++++++++++++++++- vendor/services.php | 2 +- .../think-library/src/extend/DataExtend.php | 34 ++++---- .../think-library/src/helper/FormHelper.php | 2 +- .../think-library/src/helper/PageHelper.php | 2 +- .../think-library/src/queue/ListenQueue.php | 17 ++-- .../think-library/src/queue/QueryQueue.php | 4 +- .../think-library/src/queue/StartQueue.php | 10 +-- .../think-library/src/queue/StateQueue.php | 4 +- .../think-library/src/queue/StopQueue.php | 4 +- .../think-library/src/queue/WorkQueue.php | 16 ++-- .../src/service/AdminService.php | 2 +- .../src/service/InstallService.php | 4 +- .../src/service/ProcessService.php | 2 +- .../src/service/SystemService.php | 2 +- .../src/service/TokenService.php | 2 +- 22 files changed, 174 insertions(+), 76 deletions(-) diff --git a/composer.lock b/composer.lock index e249d3222..eadb91dfa 100644 --- a/composer.lock +++ b/composer.lock @@ -151,16 +151,16 @@ }, { "name": "opis/closure", - "version": "3.4.1", + "version": "3.5.1", "source": { "type": "git", "url": "https://github.com/opis/closure.git", - "reference": "e79f851749c3caa836d7ccc01ede5828feb762c7" + "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opis/closure/zipball/e79f851749c3caa836d7ccc01ede5828feb762c7", - "reference": "e79f851749c3caa836d7ccc01ede5828feb762c7", + "url": "https://api.github.com/repos/opis/closure/zipball/93ebc5712cdad8d5f489b500c59d122df2e53969", + "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969", "shasum": "", "mirrors": [ { @@ -179,7 +179,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3.x-dev" + "dev-master": "3.5.x-dev" } }, "autoload": { @@ -214,7 +214,7 @@ "serialization", "serialize" ], - "time": "2019-10-19T18:38:51+00:00" + "time": "2019-11-29T22:36:02+00:00" }, { "name": "psr/cache", @@ -783,12 +783,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "ba4fe10a27cff9fb5bbd2a4673e0c65fb3040e62" + "reference": "82a60f7d4b2362e27318e696a231a124e5c2c793" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/ba4fe10a27cff9fb5bbd2a4673e0c65fb3040e62", - "reference": "ba4fe10a27cff9fb5bbd2a4673e0c65fb3040e62", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/82a60f7d4b2362e27318e696a231a124e5c2c793", + "reference": "82a60f7d4b2362e27318e696a231a124e5c2c793", "shasum": "", "mirrors": [ { @@ -832,7 +832,7 @@ ], "description": "ThinkPHP v6.0 Development Library", "homepage": "http://framework.thinkadmin.top", - "time": "2019-11-29T01:31:35+00:00" + "time": "2019-12-02T02:46:31+00:00" } ], "packages-dev": [], diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 44fa190b5..52fdc8042 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -148,17 +148,17 @@ }, { "name": "opis/closure", - "version": "3.4.1", - "version_normalized": "3.4.1.0", + "version": "3.5.1", + "version_normalized": "3.5.1.0", "source": { "type": "git", "url": "https://github.com/opis/closure.git", - "reference": "e79f851749c3caa836d7ccc01ede5828feb762c7" + "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opis/closure/zipball/e79f851749c3caa836d7ccc01ede5828feb762c7", - "reference": "e79f851749c3caa836d7ccc01ede5828feb762c7", + "url": "https://api.github.com/repos/opis/closure/zipball/93ebc5712cdad8d5f489b500c59d122df2e53969", + "reference": "93ebc5712cdad8d5f489b500c59d122df2e53969", "shasum": "", "mirrors": [ { @@ -174,11 +174,11 @@ "jeremeamia/superclosure": "^2.0", "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, - "time": "2019-10-19T18:38:51+00:00", + "time": "2019-11-29T22:36:02+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3.x-dev" + "dev-master": "3.5.x-dev" } }, "installation-source": "dist", @@ -805,12 +805,12 @@ "source": { "type": "git", "url": "https://github.com/zoujingli/ThinkLibrary.git", - "reference": "ba4fe10a27cff9fb5bbd2a4673e0c65fb3040e62" + "reference": "82a60f7d4b2362e27318e696a231a124e5c2c793" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/ba4fe10a27cff9fb5bbd2a4673e0c65fb3040e62", - "reference": "ba4fe10a27cff9fb5bbd2a4673e0c65fb3040e62", + "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/82a60f7d4b2362e27318e696a231a124e5c2c793", + "reference": "82a60f7d4b2362e27318e696a231a124e5c2c793", "shasum": "", "mirrors": [ { @@ -826,7 +826,7 @@ "ext-json": "*", "topthink/framework": "^6.0" }, - "time": "2019-11-29T01:31:35+00:00", + "time": "2019-12-02T02:46:31+00:00", "type": "library", "extra": { "think": { diff --git a/vendor/opis/closure/CHANGELOG.md b/vendor/opis/closure/CHANGELOG.md index f3d663fec..44370bff4 100644 --- a/vendor/opis/closure/CHANGELOG.md +++ b/vendor/opis/closure/CHANGELOG.md @@ -1,6 +1,19 @@ CHANGELOG --------- +### v3.5.1, 2019.11.30 + +- Bugfix. See #47 + +### v3.5.0, 2019.11.29 + +- Added support for short closures (arrow functions) +- Added `isShortClosure` method to `Opis\Closure\ReflectionClosure` + +### v3.4.2, 2019.11.29 + +- Added `stream_set_option()` + ### v3.4.1, 2019.10.19 - Fixed a [bug](https://github.com/opis/closure/issues/40) that prevented serialization to work correctly. diff --git a/vendor/opis/closure/README.md b/vendor/opis/closure/README.md index 75b319a42..b98d68dbd 100644 --- a/vendor/opis/closure/README.md +++ b/vendor/opis/closure/README.md @@ -61,7 +61,7 @@ Or you could directly reference it into your `composer.json` file as a dependenc ```json { "require": { - "opis/closure": "^3.4" + "opis/closure": "^3.5" } } ``` diff --git a/vendor/opis/closure/composer.json b/vendor/opis/closure/composer.json index b7a86fb65..31953f507 100644 --- a/vendor/opis/closure/composer.json +++ b/vendor/opis/closure/composer.json @@ -34,7 +34,7 @@ }, "extra": { "branch-alias": { - "dev-master": "3.3.x-dev" + "dev-master": "3.5.x-dev" } } } diff --git a/vendor/opis/closure/src/ClosureStream.php b/vendor/opis/closure/src/ClosureStream.php index 898e69ec7..f538419c1 100644 --- a/vendor/opis/closure/src/ClosureStream.php +++ b/vendor/opis/closure/src/ClosureStream.php @@ -41,6 +41,11 @@ class ClosureStream return $this->pointer >= $this->length; } + public function stream_set_option($option, $arg1, $arg2) + { + return false; + } + public function stream_stat() { $stat = stat(__FILE__); diff --git a/vendor/opis/closure/src/ReflectionClosure.php b/vendor/opis/closure/src/ReflectionClosure.php index 8c55ba164..491835eb4 100644 --- a/vendor/opis/closure/src/ReflectionClosure.php +++ b/vendor/opis/closure/src/ReflectionClosure.php @@ -19,6 +19,7 @@ class ReflectionClosure extends ReflectionFunction protected $isStaticClosure; protected $isScopeRequired; protected $isBindingRequired; + protected $isShortClosure; protected static $files = array(); protected static $classes = array(); @@ -51,6 +52,19 @@ class ReflectionClosure extends ReflectionFunction return $this->isStaticClosure; } + public function isShortClosure() + { + if ($this->isShortClosure === null) { + $code = $this->getCode(); + if ($this->isStatic()) { + $code = substr($code, 6); + } + $this->isShortClosure = strtolower(substr(trim($code), 0, 2)) === 'fn'; + } + + return $this->isShortClosure; + } + /** * @return string */ @@ -70,6 +84,7 @@ class ReflectionClosure extends ReflectionFunction } $className = null; + $fn = false; if (null !== $className = $this->getClosureScopeClass()) { @@ -89,6 +104,7 @@ class ReflectionClosure extends ReflectionFunction default: $php7_types = array('string', 'int', 'bool', 'float', 'void', 'object'); } + $fn = PHP_MINOR_VERSION === 4; } $ns = $this->getNamespaceName(); @@ -107,6 +123,7 @@ class ReflectionClosure extends ReflectionFunction $tokens = $this->getTokens(); $state = $lastState = 'start'; $inside_anonymous = false; + $isShortClosure = false; $anonymous_mark = 0; $open = 0; $code = ''; @@ -124,6 +141,10 @@ class ReflectionClosure extends ReflectionFunction if ($token[0] === T_FUNCTION || $token[0] === T_STATIC) { $code .= $token[1]; $state = $token[0] === T_FUNCTION ? 'function' : 'static'; + } elseif ($fn && $token[0] === T_FN) { + $isShortClosure = true; + $code .= $token[1]; + $state = 'closure_args'; } break; case 'static': @@ -132,6 +153,10 @@ class ReflectionClosure extends ReflectionFunction if ($token[0] === T_FUNCTION) { $state = 'function'; } + } elseif ($fn && $token[0] === T_FN) { + $isShortClosure = true; + $code .= $token[1]; + $state = 'closure_args'; } else { $code = ''; $state = 'start'; @@ -155,6 +180,10 @@ class ReflectionClosure extends ReflectionFunction if($token[0] === T_FUNCTION || $token[0] === T_STATIC){ $code = $token[1]; $state = $token[0] === T_FUNCTION ? 'function' : 'static'; + } elseif ($fn && $token[0] === T_FN) { + $isShortClosure = true; + $code .= $token[1]; + $state = 'closure_args'; } break; case 'closure_args': @@ -172,6 +201,12 @@ class ReflectionClosure extends ReflectionFunction $code .= $token[1]; $state = 'use'; break; + case T_DOUBLE_ARROW: + $code .= $token[1]; + if ($isShortClosure) { + $state = 'closure'; + } + break; case '=': $code .= $token; $lastState = 'closure_args'; @@ -226,6 +261,12 @@ class ReflectionClosure extends ReflectionFunction $state = 'id_name'; $lastState = 'return'; break 2; + case T_DOUBLE_ARROW: + $code .= $token[1]; + if ($isShortClosure) { + $state = 'closure'; + } + break; case '{': $code .= '{'; $state = 'closure'; @@ -247,12 +288,36 @@ class ReflectionClosure extends ReflectionFunction break; case '}': $code .= '}'; - if(--$open === 0){ + if(--$open === 0 && !$isShortClosure){ break 3; } elseif ($inside_anonymous) { $inside_anonymous = !($open === $anonymous_mark); } break; + case '(': + case '[': + $code .= $token[0]; + if ($isShortClosure) { + $open++; + } + break; + case ')': + case ']': + if ($isShortClosure) { + if ($open === 0) { + break 3; + } + --$open; + } + $code .= $token[0]; + break; + case ',': + case ';': + if ($isShortClosure && $open === 0) { + break 3; + } + $code .= $token[0]; + break; case T_LINE: $code .= $token[2] - $line + $lineAdd; break; @@ -432,6 +497,9 @@ class ReflectionClosure extends ReflectionFunction $id_name .= $token[1]; break; case '(': + if ($isShortClosure) { + $open++; + } if($context === 'new' || false !== strpos($id_name, '\\')){ if($id_start !== '\\'){ if ($classes === null) { @@ -538,10 +606,17 @@ class ReflectionClosure extends ReflectionFunction } } + if ($isShortClosure) { + $code .= ';'; + $this->useVariables = $this->getStaticVariables(); + } else { + $this->useVariables = empty($use) ? $use : array_intersect_key($this->getStaticVariables(), array_flip($use)); + } + + $this->isShortClosure = $isShortClosure; $this->isBindingRequired = $isUsingThisObject; $this->isScopeRequired = $isUsingScope; $this->code = $code; - $this->useVariables = empty($use) ? $use : array_intersect_key($this->getStaticVariables(), array_flip($use)); return $this->code; } diff --git a/vendor/services.php b/vendor/services.php index fb96ee6a7..fe0915a3f 100644 --- a/vendor/services.php +++ b/vendor/services.php @@ -1,5 +1,5 @@ 'think\\app\\Service', diff --git a/vendor/zoujingli/think-library/src/extend/DataExtend.php b/vendor/zoujingli/think-library/src/extend/DataExtend.php index 62a5436b8..0a25cf85f 100644 --- a/vendor/zoujingli/think-library/src/extend/DataExtend.php +++ b/vendor/zoujingli/think-library/src/extend/DataExtend.php @@ -26,18 +26,18 @@ class DataExtend /** * 一维数据数组生成数据树 * @param array $list 数据列表 - * @param string $id 父ID Key - * @param string $pid ID Key - * @param string $son 定义子数据Key + * @param string $key ID_KEY + * @param string $pkey PID_KEY + * @param string $skey 子数据名称 * @return array */ - public static function arr2tree($list, $id = 'id', $pid = 'pid', $son = 'sub') + public static function arr2tree($list, $key = 'id', $pkey = 'pid', $skey = 'sub') { list($tree, $map) = [[], []]; - foreach ($list as $item) $map[$item[$id]] = $item; - foreach ($list as $item) if (isset($item[$pid]) && isset($map[$item[$pid]])) { - $map[$item[$pid]][$son][] = &$map[$item[$id]]; - } else $tree[] = &$map[$item[$id]]; + foreach ($list as $item) $map[$item[$key]] = $item; + foreach ($list as $item) if (isset($item[$pkey]) && isset($map[$item[$pkey]])) { + $map[$item[$pkey]][$skey][] = &$map[$item[$key]]; + } else $tree[] = &$map[$item[$key]]; unset($map); return $tree; } @@ -45,24 +45,24 @@ class DataExtend /** * 一维数据数组生成数据树 * @param array $list 数据列表 - * @param string $id ID Key - * @param string $pid 父ID Key + * @param string $key ID_KEY + * @param string $pkey PID_KEY * @param string $path * @param string $ppath * @return array */ - public static function arr2table(array $list, $id = 'id', $pid = 'pid', $path = 'path', $ppath = '') + public static function arr2table(array $list, $key = 'id', $pkey = 'pid', $path = 'path', $ppath = '') { $tree = []; - foreach (self::arr2tree($list, $id, $pid) as $attr) { - $attr[$path] = "{$ppath}-{$attr[$id]}"; + foreach (self::arr2tree($list, $key, $pkey) as $attr) { + $attr[$path] = "{$ppath}-{$attr[$key]}"; $attr['sub'] = isset($attr['sub']) ? $attr['sub'] : []; $attr['spt'] = substr_count($ppath, '-'); $attr['spl'] = str_repeat(" ├ ", $attr['spt']); $sub = $attr['sub']; unset($attr['sub']); $tree[] = $attr; - if (!empty($sub)) $tree = array_merge($tree, self::arr2table($sub, $id, $pid, $path, $attr[$path])); + if (!empty($sub)) $tree = array_merge($tree, self::arr2table($sub, $key, $pkey, $path, $attr[$path])); } return $tree; } @@ -70,9 +70,9 @@ class DataExtend /** * 获取数据树子ID * @param array $list 数据列表 - * @param int $id 起始ID - * @param string $key 子Key - * @param string $pkey 父Key + * @param integer $id 起始ID + * @param string $key ID_KEY + * @param string $pkey PID_KEY * @return array */ public static function getArrSubIds($list, $id = 0, $key = 'id', $pkey = 'pid') diff --git a/vendor/zoujingli/think-library/src/helper/FormHelper.php b/vendor/zoujingli/think-library/src/helper/FormHelper.php index afc288657..650152e4a 100644 --- a/vendor/zoujingli/think-library/src/helper/FormHelper.php +++ b/vendor/zoujingli/think-library/src/helper/FormHelper.php @@ -62,7 +62,7 @@ class FormHelper extends Helper * @param string $field 指定数据主键 * @param array $where 额外更新条件 * @param array $data 表单扩展数据 - * @return array|boolean + * @return array|boolean|mixed * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException diff --git a/vendor/zoujingli/think-library/src/helper/PageHelper.php b/vendor/zoujingli/think-library/src/helper/PageHelper.php index f5e1e2468..86277630f 100644 --- a/vendor/zoujingli/think-library/src/helper/PageHelper.php +++ b/vendor/zoujingli/think-library/src/helper/PageHelper.php @@ -56,7 +56,7 @@ class PageHelper extends Helper * @param boolean $display 是否渲染模板 * @param boolean $total 集合分页记录数 * @param integer $limit 集合每页记录数 - * @return array + * @return array|mixed * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException diff --git a/vendor/zoujingli/think-library/src/queue/ListenQueue.php b/vendor/zoujingli/think-library/src/queue/ListenQueue.php index f606996d4..a7ff4c9e9 100644 --- a/vendor/zoujingli/think-library/src/queue/ListenQueue.php +++ b/vendor/zoujingli/think-library/src/queue/ListenQueue.php @@ -37,14 +37,15 @@ class ListenQueue extends Command /** * 执行进程守护监听 - * @param Input $input - * @param Output $output + * @param Input $input 输入对象 + * @param Output $output 输出对象 * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ protected function execute(Input $input, Output $output) { + set_time_limit(0); $this->app->db->name('SystemQueue')->count(); if (($process = ProcessService::instance())->iswin()) { $this->setProcessTitle("ThinkAdmin 监听主进程 {$process->version()}"); @@ -52,18 +53,18 @@ class ListenQueue extends Command $output->writeln('============ 任务监听中 ============'); while (true) { $where = [['status', '=', '1'], ['exec_time', '<=', time()]]; - $this->app->db->name('SystemQueue')->where($where)->order('exec_time asc')->limit(100)->select()->each(function ($vo) use ($process, $output) { + $this->app->db->name('SystemQueue')->where($where)->order('exec_time asc')->limit(100)->select()->each(function ($vo) use ($process) { try { - $this->update($vo['code'], ['status' => '2', 'enter_time' => time(), 'exec_desc' => '', 'attempts' => $vo['attempts'] + 1]); - if ($process->query($command = $process->think("xtask:_work {$vo['code']} -"))) { - $output->writeln("正在执行 -> [{$vo['code']}] {$vo['title']}"); + $command = $process->think("xtask:_work {$vo['code']} -"); + if (count($process->query($command)) > 0) { + $this->output->warning("正在执行 -> [{$vo['code']}] {$vo['title']}"); } else { $process->create($command); - $output->writeln("创建成功 -> [{$vo['code']}] {$vo['title']}"); + $this->output->info("开始执行 -> [{$vo['code']}] {$vo['title']}"); } } catch (\Exception $e) { $this->update($vo['code'], ['status' => '4', 'outer_time' => time(), 'exec_desc' => $e->getMessage()]); - $output->writeln("创建失败 -> [{$vo['code']}] {$vo['title']},{$e->getMessage()}"); + $this->output->error("执行失败 -> [{$vo['code']}] {$vo['title']},{$e->getMessage()}"); } }); sleep(1); diff --git a/vendor/zoujingli/think-library/src/queue/QueryQueue.php b/vendor/zoujingli/think-library/src/queue/QueryQueue.php index bbfdbf13c..575137f46 100644 --- a/vendor/zoujingli/think-library/src/queue/QueryQueue.php +++ b/vendor/zoujingli/think-library/src/queue/QueryQueue.php @@ -37,8 +37,8 @@ class QueryQueue extends Command /** * 执行相关进程查询 - * @param Input $input - * @param Output $output + * @param Input $input 输入对象 + * @param Output $output 输出对象 */ protected function execute(Input $input, Output $output) { diff --git a/vendor/zoujingli/think-library/src/queue/StartQueue.php b/vendor/zoujingli/think-library/src/queue/StartQueue.php index ffbc4b7b4..a5ec67dd1 100644 --- a/vendor/zoujingli/think-library/src/queue/StartQueue.php +++ b/vendor/zoujingli/think-library/src/queue/StartQueue.php @@ -38,8 +38,8 @@ class StartQueue extends Command /** * 执行启动操作 - * @param Input $input - * @param Output $output + * @param Input $input 输入对象 + * @param Output $output 输出对象 */ protected function execute(Input $input, Output $output) { @@ -47,14 +47,14 @@ class StartQueue extends Command $process = ProcessService::instance(); $command = $process->think("xtask:listen"); if (count($result = $process->query($command)) > 0) { - $output->writeln("监听主进程{$result['0']['pid']}已经启动!"); + $output->info("监听主进程{$result['0']['pid']}已经启动!"); } else { $process->create($command); sleep(1); if (count($result = $process->query($command)) > 0) { - $output->writeln("监听主进程{$result['0']['pid']}启动成功!"); + $output->info("监听主进程{$result['0']['pid']}启动成功!"); } else { - $output->writeln('监听主进程创建失败!'); + $output->error('监听主进程创建失败!'); } } } diff --git a/vendor/zoujingli/think-library/src/queue/StateQueue.php b/vendor/zoujingli/think-library/src/queue/StateQueue.php index 108453d0d..164196e10 100644 --- a/vendor/zoujingli/think-library/src/queue/StateQueue.php +++ b/vendor/zoujingli/think-library/src/queue/StateQueue.php @@ -45,9 +45,9 @@ class StateQueue extends Command $process = ProcessService::instance(); $command = $process->think('xtask:listen'); if (count($result = $process->query($command)) > 0) { - $output->writeln("任务监听主进程{$result[0]['pid']}正在运行..."); + $output->info("任务监听主进程{$result[0]['pid']}正在运行..."); } else { - $output->writeln("任务监听主进程没有运行哦!"); + $output->warning("任务监听主进程没有运行哦!"); } } } diff --git a/vendor/zoujingli/think-library/src/queue/StopQueue.php b/vendor/zoujingli/think-library/src/queue/StopQueue.php index 5225ca589..55b6e37a1 100644 --- a/vendor/zoujingli/think-library/src/queue/StopQueue.php +++ b/vendor/zoujingli/think-library/src/queue/StopQueue.php @@ -46,10 +46,10 @@ class StopQueue extends Command $process = ProcessService::instance(); $command = $process->think('xtask:'); if (count($result = $process->query($command)) < 1) { - $output->writeln("没有需要结束的任务进程哦!"); + $output->warning("没有需要结束的任务进程哦!"); } else foreach ($result as $item) { $process->close($item['pid']); - $output->writeln("发送结束进程{$item['pid']}信号成功!"); + $output->info("发送结束进程{$item['pid']}信号成功!"); } } } diff --git a/vendor/zoujingli/think-library/src/queue/WorkQueue.php b/vendor/zoujingli/think-library/src/queue/WorkQueue.php index c347fb43a..e2c738a46 100644 --- a/vendor/zoujingli/think-library/src/queue/WorkQueue.php +++ b/vendor/zoujingli/think-library/src/queue/WorkQueue.php @@ -50,22 +50,26 @@ class WorkQueue extends Command { $this->setName('xtask:_work')->setDescription('[执行]创建执行任务的进程'); $this->addArgument('code', Argument::OPTIONAL, '任务编号'); - $this->addArgument('splt', Argument::OPTIONAL, '指令结束符'); + $this->addArgument('spts', Argument::OPTIONAL, '指令结束符'); } /** - * 任务执行 - * @param Input $input - * @param Output $output + * @param Input $input 输入对象 + * @param Output $output 输出对象 * @throws \think\db\exception\DbException */ protected function execute(Input $input, Output $output) { try { + set_time_limit(0); $this->code = trim($input->getArgument('code')); if (empty($this->code)) throw new Exception("执行任务需要指定任务编号!"); - $queue = $this->app->db->name('SystemQueue')->where(['code' => $this->code, 'status' => '2'])->find(); - if (empty($queue)) throw new Exception("执行任务{$this->code}的信息或状态异常!");; + $queue = $this->app->db->name('SystemQueue')->where(['code' => $this->code, 'status' => '1'])->find(); + if (empty($queue)) throw new Exception("执行任务{$this->code}的信息或状态异常!"); + // 锁定任务状态 + $this->app->db->name('SystemQueue')->where(['code' => $this->code])->update([ + 'status' => '2', 'enter_time' => time(), 'exec_desc' => '', 'attempts' => $this->app->db->raw('attempts+1'), + ]); // 设置进程标题 if (($process = ProcessService::instance())->iswin()) { $this->setProcessTitle("ThinkAdmin {$process->version()} 执行任务 - {$queue['title']}"); diff --git a/vendor/zoujingli/think-library/src/service/AdminService.php b/vendor/zoujingli/think-library/src/service/AdminService.php index 46556cca9..f562ec53c 100644 --- a/vendor/zoujingli/think-library/src/service/AdminService.php +++ b/vendor/zoujingli/think-library/src/service/AdminService.php @@ -85,7 +85,7 @@ class AdminService extends Service /** * 初始化用户权限 * @param boolean $force 强刷权限 - * @return AdminService + * @return $this * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException diff --git a/vendor/zoujingli/think-library/src/service/InstallService.php b/vendor/zoujingli/think-library/src/service/InstallService.php index 3d22ab3eb..ffbfc3e8f 100644 --- a/vendor/zoujingli/think-library/src/service/InstallService.php +++ b/vendor/zoujingli/think-library/src/service/InstallService.php @@ -56,8 +56,8 @@ class InstallService extends Service protected $ignore = []; /** - * 服务初始化 - * @return static + * 初始化服务 + * @return $this */ public function initialize(): Service { diff --git a/vendor/zoujingli/think-library/src/service/ProcessService.php b/vendor/zoujingli/think-library/src/service/ProcessService.php index 1dbea40d2..69d89e00c 100644 --- a/vendor/zoujingli/think-library/src/service/ProcessService.php +++ b/vendor/zoujingli/think-library/src/service/ProcessService.php @@ -48,7 +48,7 @@ class ProcessService extends Service /** * 创建异步进程 * @param string $command 任务指令 - * @return ProcessService + * @return $this */ public function create($command) { diff --git a/vendor/zoujingli/think-library/src/service/SystemService.php b/vendor/zoujingli/think-library/src/service/SystemService.php index 82cd0b634..76af2ad9b 100644 --- a/vendor/zoujingli/think-library/src/service/SystemService.php +++ b/vendor/zoujingli/think-library/src/service/SystemService.php @@ -85,7 +85,7 @@ class SystemService extends Service * @param array $data 需要保存或更新的数据 * @param string $key 条件主键限制 * @param array $where 其它的where条件 - * @return bool|int|mixed|string + * @return boolean|integer * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException diff --git a/vendor/zoujingli/think-library/src/service/TokenService.php b/vendor/zoujingli/think-library/src/service/TokenService.php index 90a6baa5a..b148388bf 100644 --- a/vendor/zoujingli/think-library/src/service/TokenService.php +++ b/vendor/zoujingli/think-library/src/service/TokenService.php @@ -53,7 +53,7 @@ class TokenService extends Service /** * 清理表单CSRF信息 * @param string $token - * @return TokenService + * @return $this */ public function clearFormToken($token = null) {