mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
ComposerUpdate
This commit is contained in:
parent
77fc2b0fa2
commit
9a14e8dbe5
20
composer.lock
generated
20
composer.lock
generated
@ -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": [],
|
||||
|
22
vendor/composer/installed.json
vendored
22
vendor/composer/installed.json
vendored
@ -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": {
|
||||
|
13
vendor/opis/closure/CHANGELOG.md
vendored
13
vendor/opis/closure/CHANGELOG.md
vendored
@ -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.
|
||||
|
2
vendor/opis/closure/README.md
vendored
2
vendor/opis/closure/README.md
vendored
@ -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"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
2
vendor/opis/closure/composer.json
vendored
2
vendor/opis/closure/composer.json
vendored
@ -34,7 +34,7 @@
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.3.x-dev"
|
||||
"dev-master": "3.5.x-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
5
vendor/opis/closure/src/ClosureStream.php
vendored
5
vendor/opis/closure/src/ClosureStream.php
vendored
@ -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__);
|
||||
|
79
vendor/opis/closure/src/ReflectionClosure.php
vendored
79
vendor/opis/closure/src/ReflectionClosure.php
vendored
@ -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;
|
||||
}
|
||||
|
2
vendor/services.php
vendored
2
vendor/services.php
vendored
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// This file is automatically generated at:2019-11-29 11:11:35
|
||||
// This file is automatically generated at:2019-12-02 10:51:21
|
||||
declare (strict_types = 1);
|
||||
return array (
|
||||
0 => 'think\\app\\Service',
|
||||
|
@ -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')
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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('监听主进程创建失败!');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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("任务监听主进程没有运行哦!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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']}信号成功!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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']}");
|
||||
|
@ -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
|
||||
|
@ -56,8 +56,8 @@ class InstallService extends Service
|
||||
protected $ignore = [];
|
||||
|
||||
/**
|
||||
* 服务初始化
|
||||
* @return static
|
||||
* 初始化服务
|
||||
* @return $this
|
||||
*/
|
||||
public function initialize(): Service
|
||||
{
|
||||
|
@ -48,7 +48,7 @@ class ProcessService extends Service
|
||||
/**
|
||||
* 创建异步进程
|
||||
* @param string $command 任务指令
|
||||
* @return ProcessService
|
||||
* @return $this
|
||||
*/
|
||||
public function create($command)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -53,7 +53,7 @@ class TokenService extends Service
|
||||
/**
|
||||
* 清理表单CSRF信息
|
||||
* @param string $token
|
||||
* @return TokenService
|
||||
* @return $this
|
||||
*/
|
||||
public function clearFormToken($token = null)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user