ComposerUpdate

This commit is contained in:
Anyon 2020-03-24 14:58:13 +08:00
parent a1fd701d87
commit 093f8f8dfd
10 changed files with 26 additions and 24 deletions

View File

@ -15,7 +15,7 @@
{/if} {/if}
{if auth("clear")} {if auth("clear")}
<button data-load='{:url("clear")}' data-confirm="确定要定时清理7天前的记录吗?" class='layui-btn layui-btn-sm layui-btn-primary'>定时清理</button> <button data-load='{:url("clear")}' data-confirm="确定要创建定时清理任务吗?" class='layui-btn layui-btn-sm layui-btn-primary'>定时清理</button>
{/if} {/if}
{/block} {/block}

8
composer.lock generated
View File

@ -909,12 +909,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "28760760070a34a5b21ab1d6754b223d139d79a3" "reference": "a247fea1b1a6b9bbc9f378f944531f222800fab5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/28760760070a34a5b21ab1d6754b223d139d79a3", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/a247fea1b1a6b9bbc9f378f944531f222800fab5",
"reference": "28760760070a34a5b21ab1d6754b223d139d79a3", "reference": "a247fea1b1a6b9bbc9f378f944531f222800fab5",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -958,7 +958,7 @@
], ],
"description": "ThinkPHP v6.0 Development Library", "description": "ThinkPHP v6.0 Development Library",
"homepage": "http://framework.thinkadmin.top", "homepage": "http://framework.thinkadmin.top",
"time": "2020-03-24T02:35:13+00:00" "time": "2020-03-24T06:40:00+00:00"
}, },
{ {
"name": "zoujingli/wechat-developer", "name": "zoujingli/wechat-developer",

View File

@ -935,12 +935,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "28760760070a34a5b21ab1d6754b223d139d79a3" "reference": "a247fea1b1a6b9bbc9f378f944531f222800fab5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/28760760070a34a5b21ab1d6754b223d139d79a3", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/a247fea1b1a6b9bbc9f378f944531f222800fab5",
"reference": "28760760070a34a5b21ab1d6754b223d139d79a3", "reference": "a247fea1b1a6b9bbc9f378f944531f222800fab5",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -956,7 +956,7 @@
"ext-json": "*", "ext-json": "*",
"topthink/framework": "^6.0" "topthink/framework": "^6.0"
}, },
"time": "2020-03-24T02:35:13+00:00", "time": "2020-03-24T06:40:00+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:2020-03-24 10:42:29 // This file is automatically generated at:2020-03-24 14:58:02
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\app\\Service', 0 => 'think\\app\\Service',

View File

@ -29,7 +29,7 @@ use function Composer\Autoload\includeFile;
class Library extends Service class Library extends Service
{ {
/** /**
* 注册服务 * 注册初始化服务
*/ */
public function register() public function register()
{ {

View File

@ -65,7 +65,7 @@ abstract class Storage
/** /**
* 存储初始化 * 存储初始化
* @return AliossStorage|LocalStorage|QiniuStorage * @return Storage|AliossStorage|LocalStorage|QiniuStorage
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
@ -81,7 +81,7 @@ abstract class Storage
* @param string $method 方法名称 * @param string $method 方法名称
* @param array $arguments 调用参数 * @param array $arguments 调用参数
* @return mixed * @return mixed
* @throws \think\Exception * @throws Exception
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
@ -91,7 +91,7 @@ abstract class Storage
if (method_exists($class = self::instance(), $method)) { if (method_exists($class = self::instance(), $method)) {
return call_user_func_array([$class, $method], $arguments); return call_user_func_array([$class, $method], $arguments);
} else { } else {
throw new \think\Exception("method not exists: " . get_class($class) . "->{$method}()"); throw new Exception("method not exists: " . get_class($class) . "->{$method}()");
} }
} }
@ -99,7 +99,7 @@ abstract class Storage
* 设置文件驱动名称 * 设置文件驱动名称
* @param string $name 驱动名称 * @param string $name 驱动名称
* @return AliossStorage|LocalStorage|QiniuStorage * @return AliossStorage|LocalStorage|QiniuStorage
* @throws \think\Exception * @throws Exception
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
@ -110,7 +110,7 @@ abstract class Storage
if (class_exists($object = "think\\admin\\storage\\{$class}Storage")) { if (class_exists($object = "think\\admin\\storage\\{$class}Storage")) {
return Container::getInstance()->make($object)->initialize(); return Container::getInstance()->make($object)->initialize();
} else { } else {
throw new \think\Exception("File driver [{$class}] does not exist."); throw new Exception("File driver [{$class}] does not exist.");
} }
} }

View File

@ -53,17 +53,19 @@ class CleanQueue extends Queue
{ {
$this->time = $input->getArgument('time'); $this->time = $input->getArgument('time');
if (empty($this->time) || !is_numeric($this->time) || $this->time <= 0) { if (empty($this->time) || !is_numeric($this->time) || $this->time <= 0) {
$this->output->error('Wrong parameter, the deadline needs to be an integer'); $this->setQueueMessage(4, "参数错误,需要传入任务超时时间");
} else { } else {
$map = [['exec_time', '<', time() - $this->time]]; $map = [['exec_time', '<', time() - $this->time]];
$count1 = $this->app->db->name($this->table)->where($map)->delete(); $count1 = $this->app->db->name($this->table)->where($map)->delete();
$this->output->info("Successfully cleaned up {$count1} history task records"); $this->setQueueProgress(2, "清理 {$count1} 条历史任务成功", 50);
// 重置超60分钟无响应的记录 // 重置超60分钟无响应的记录
$map = [['exec_time', '<', time() - 3600], ['status', '=', '2']]; $map = [['exec_time', '<', time() - 3600], ['status', '=', '2']];
$count2 = $this->app->db->name($this->table)->where($map)->update(['status' => '4', 'exec_desc' => '执行等待超过60分钟无响应']); $count2 = $this->app->db->name($this->table)->where($map)->update([
$this->output->info("Successfully processed {$count2} unresponsive records waiting for more than 1 hour"); 'status' => '4', 'exec_desc' => '任务执行超时,已自动标识为失败!',
]);
$this->setQueueProgress(2, "处理 {$count2} 条超时间任务成功", 100);
// 返回消息到任务状态描述 // 返回消息到任务状态描述
if (defined('WorkQueueCall')) throw new \think\admin\Exception("清理 {$count1} 条 + 无响应 {$count2}", 3); $this->setQueueMessage(3, "清理 {$count1} 条 + 无响应 {$count2}");
} }
} }
} }

View File

@ -85,7 +85,7 @@ class AliossStorage extends Storage
* 获取当前实例对象 * 获取当前实例对象
* @param null $name * @param null $name
* @return AliossStorage|LocalStorage|QiniuStorage * @return AliossStorage|LocalStorage|QiniuStorage
* @throws \think\Exception * @throws \think\admin\Exception
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException

View File

@ -54,7 +54,7 @@ class LocalStorage extends Storage
* 获取当前实例对象 * 获取当前实例对象
* @param null $name * @param null $name
* @return AliossStorage|LocalStorage|QiniuStorage * @return AliossStorage|LocalStorage|QiniuStorage
* @throws \think\Exception * @throws \think\admin\Exception
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException

View File

@ -59,7 +59,7 @@ class QiniuStorage extends Storage
* 获取当前实例对象 * 获取当前实例对象
* @param null $name * @param null $name
* @return AliossStorage|LocalStorage|QiniuStorage * @return AliossStorage|LocalStorage|QiniuStorage
* @throws \think\Exception * @throws \think\admin\Exception
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException