修改系统任务支持

This commit is contained in:
Anyon 2020-01-09 16:09:59 +08:00
parent 95f2b97579
commit 1a3ecdb509
4 changed files with 20 additions and 19 deletions

View File

@ -17,6 +17,7 @@ namespace app\admin\controller;
use think\admin\Controller;
use think\admin\service\ProcessService;
use think\admin\service\QueueService;
use think\exception\HttpResponseException;
/**
@ -108,22 +109,6 @@ class Queue extends Controller
}
}
/**
* 清理3天前的记录
* @auth true
* @throws \think\db\exception\DbException
*/
public function clear()
{
$map = [['exec_time', '<', strtotime('-7days')]];
$result = $this->app->db->name($this->table)->where($map)->delete();
if ($result !== false) {
$this->success('成功清理7天前的任务记录');
} else {
$this->error('清理7天前的任务记录失败');
}
}
/**
* WIN停止监听进程
* @auth true
@ -146,6 +131,20 @@ class Queue extends Controller
}
}
/**
* 创建记录清理任务
* @auth true
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function clear()
{
QueueService::instance()->addCleanQueue();
$this->success('创建清理任务成功!');
}
/**
* 删除系统任务
* @auth true

View File

@ -93,7 +93,7 @@
{/if}
</td>
<td class='text-left nowrap'>
<div class="margin-bottom-10">
<div class="margin-bottom-5">
{if isset($vo.loops_time) and $vo.loops_time > 0}
<span class="layui-badge layui-bg-orange margin-right-5"></span>
{/if}

View File

@ -56,7 +56,9 @@ class Fans extends Command
$message .= $this->$fun();
}
}
throw new \think\Exception($message, 3);
if (defined('WorkQueueCall')) {
throw new \think\Exception($message, 3);
}
}
/**

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php
// This file is automatically generated at:2020-01-09 15:55:25
// This file is automatically generated at:2020-01-09 16:09:21
declare (strict_types = 1);
return array (
0 => 'think\\app\\Service',