mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
CompoerUpdate
This commit is contained in:
parent
c285caef3d
commit
a60441174d
39
admin_v6.sql
39
admin_v6.sql
@ -172,28 +172,29 @@ CREATE TABLE `system_oplog` (
|
||||
-- Table structure for system_queue
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `system_queue`;
|
||||
CREATE TABLE `system_queue` (
|
||||
CREATE TABLE `system_queue` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '任务编号',
|
||||
`title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '任务名称',
|
||||
`command` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '执行指令',
|
||||
`exec_data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '执行参数',
|
||||
`exec_time` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '执行时间',
|
||||
`exec_desc` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '状态描述',
|
||||
`enter_time` decimal(20, 4) NULL DEFAULT 0.0000 COMMENT '开始时间',
|
||||
`outer_time` decimal(20, 4) NULL DEFAULT 0.0000 COMMENT '结束时间',
|
||||
`attempts` bigint(20) NULL DEFAULT 0 COMMENT '执行次数',
|
||||
`rscript` tinyint(1) NULL DEFAULT 1 COMMENT '单例模式',
|
||||
`status` tinyint(1) NULL DEFAULT 1 COMMENT '任务状态(1新任务,2处理中,3成功,4失败)',
|
||||
`code` varchar(20) NOT NULL DEFAULT '' COMMENT '任务编号',
|
||||
`title` varchar(50) NOT NULL DEFAULT '' COMMENT '任务名称',
|
||||
`command` varchar(500) DEFAULT '' COMMENT '执行指令',
|
||||
`exec_pid` bigint(20) DEFAULT '0' COMMENT '执行进程',
|
||||
`exec_data` longtext COMMENT '执行参数',
|
||||
`exec_time` bigint(20) DEFAULT '0' COMMENT '执行时间',
|
||||
`exec_desc` varchar(500) DEFAULT '' COMMENT '状态描述',
|
||||
`enter_time` decimal(20,4) DEFAULT '0.0000' COMMENT '开始时间',
|
||||
`outer_time` decimal(20,4) DEFAULT '0.0000' COMMENT '结束时间',
|
||||
`attempts` bigint(20) DEFAULT '0' COMMENT '执行次数',
|
||||
`rscript` tinyint(1) DEFAULT '1' COMMENT '执行模式(0单例,1多例)',
|
||||
`status` tinyint(1) DEFAULT '1' COMMENT '任务状态(1新任务,2处理中,3成功,4失败)',
|
||||
`create_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
INDEX `idx_system_queue_code`(`code`) USING BTREE,
|
||||
INDEX `idx_system_queue_title`(`title`) USING BTREE,
|
||||
INDEX `idx_system_queue_status`(`status`) USING BTREE,
|
||||
INDEX `idx_system_queue_rscript`(`rscript`) USING BTREE,
|
||||
INDEX `idx_system_queue_create_at`(`create_at`) USING BTREE,
|
||||
INDEX `idx_system_queue_exec_time`(`exec_time`) USING BTREE
|
||||
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统-任务';
|
||||
KEY `idx_system_queue_code` (`code`) USING BTREE,
|
||||
KEY `idx_system_queue_title` (`title`) USING BTREE,
|
||||
KEY `idx_system_queue_status` (`status`) USING BTREE,
|
||||
KEY `idx_system_queue_rscript` (`rscript`) USING BTREE,
|
||||
KEY `idx_system_queue_create_at` (`create_at`) USING BTREE,
|
||||
KEY `idx_system_queue_exec_time` (`exec_time`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT='系统-任务';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for system_user
|
||||
|
@ -79,14 +79,11 @@
|
||||
<span class="color-desc">任务指令:{$vo.command|default=''}</span>
|
||||
</td>
|
||||
<td class='text-left nowrap'>
|
||||
计划时间:{$vo.exec_time|format_datetime}<br>
|
||||
计划时间:{$vo.exec_time|format_datetime} {if isset($vo.exec_pid) and $vo.exec_pid>0}( 进程 <b class="color-blue">{$vo.exec_pid|default='-'}</b> ){/if}<br>
|
||||
{if $vo.status eq 3 or $vo.status eq 4}
|
||||
执行时间:{$vo.enter_time|format_datetime}( 耗时 <b class="color-blue">{:sprintf("%.4f",$vo.outer_time-$vo.enter_time)}</b> 秒 )
|
||||
{elseif $vo.status eq 2}
|
||||
开始时间:{$vo.enter_time|format_datetime}
|
||||
{else}
|
||||
创建时间:{$vo.create_at|format_datetime}
|
||||
{/if}
|
||||
{elseif $vo.status eq 2} 开始时间:{$vo.enter_time|format_datetime}
|
||||
{else} 创建时间:{$vo.create_at|format_datetime} {/if}
|
||||
</td>
|
||||
<td class='text-left nowrap'>
|
||||
|
||||
|
8
composer.lock
generated
8
composer.lock
generated
@ -909,12 +909,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
||||
"reference": "cfd590be48a94d97e986cc67e2043a8b96611371"
|
||||
"reference": "da9b19733aa956650b201c1351886ac045119453"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/cfd590be48a94d97e986cc67e2043a8b96611371",
|
||||
"reference": "cfd590be48a94d97e986cc67e2043a8b96611371",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/da9b19733aa956650b201c1351886ac045119453",
|
||||
"reference": "da9b19733aa956650b201c1351886ac045119453",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -958,7 +958,7 @@
|
||||
],
|
||||
"description": "ThinkPHP v6.0 Development Library",
|
||||
"homepage": "http://framework.thinkadmin.top",
|
||||
"time": "2020-01-06T07:30:03+00:00"
|
||||
"time": "2020-01-06T07:42:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "zoujingli/wechat-developer",
|
||||
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
@ -935,12 +935,12 @@
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/zoujingli/ThinkLibrary.git",
|
||||
"reference": "cfd590be48a94d97e986cc67e2043a8b96611371"
|
||||
"reference": "da9b19733aa956650b201c1351886ac045119453"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/cfd590be48a94d97e986cc67e2043a8b96611371",
|
||||
"reference": "cfd590be48a94d97e986cc67e2043a8b96611371",
|
||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/da9b19733aa956650b201c1351886ac045119453",
|
||||
"reference": "da9b19733aa956650b201c1351886ac045119453",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@ -956,7 +956,7 @@
|
||||
"ext-json": "*",
|
||||
"topthink/framework": "^6.0"
|
||||
},
|
||||
"time": "2020-01-06T07:30:03+00:00",
|
||||
"time": "2020-01-06T07:42:55+00:00",
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"think": {
|
||||
|
2
vendor/services.php
vendored
2
vendor/services.php
vendored
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// This file is automatically generated at:2020-01-06 15:31:56
|
||||
// This file is automatically generated at:2020-01-06 15:45:08
|
||||
declare (strict_types = 1);
|
||||
return array (
|
||||
0 => 'think\\app\\Service',
|
||||
|
@ -49,8 +49,7 @@ class ListenQueue extends Command
|
||||
* @param Output $output 输出对象
|
||||
*/
|
||||
protected function execute(Input $input, Output $output)
|
||||
{ $this->output->writeln('进程');
|
||||
$this->output->writeln(getmypid());
|
||||
{
|
||||
set_time_limit(0);
|
||||
$this->app->db->name('SystemQueue')->count();
|
||||
if (($this->process = ProcessService::instance())->iswin()) {
|
||||
@ -86,8 +85,6 @@ class ListenQueue extends Command
|
||||
*/
|
||||
protected function update($code, array $data = [])
|
||||
{
|
||||
|
||||
|
||||
return $this->app->db->name('SystemQueue')->where(['code' => $code])->update($data);
|
||||
}
|
||||
|
||||
|
@ -73,8 +73,7 @@ class WorkQueue extends Command
|
||||
} else {
|
||||
// 锁定任务状态
|
||||
$this->app->db->name($this->table)->strict(false)->where(['code' => $this->code])->update([
|
||||
'status' => '2', 'enter_time' => microtime(true), 'outer_time' => '0',
|
||||
'exec_pid' => getmygid(), 'exec_desc' => '', 'attempts' => $this->app->db->raw('attempts+1'),
|
||||
'status' => '2', 'enter_time' => microtime(true), 'outer_time' => '0', 'exec_pid' => getmypid(), 'exec_desc' => '', 'attempts' => $this->app->db->raw('attempts+1'),
|
||||
]);
|
||||
// 设置进程标题
|
||||
if (($process = ProcessService::instance())->iswin()) {
|
||||
@ -115,7 +114,7 @@ class WorkQueue extends Command
|
||||
{
|
||||
$desc = explode("\n", trim(is_string($message) ? $message : ''));
|
||||
$result = $this->app->db->name($this->table)->strict(false)->where(['code' => $this->code])->update([
|
||||
'status' => $status, 'outer_time' => microtime(true), 'exec_pid' => getmygid(), 'exec_desc' => $desc[0],
|
||||
'status' => $status, 'outer_time' => microtime(true), 'exec_pid' => getmypid(), 'exec_desc' => $desc[0],
|
||||
]);
|
||||
$this->output->writeln(is_string($message) ? $message : '');
|
||||
return $result == false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user