mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
[更新]修改任务管理
This commit is contained in:
parent
1f94b748d4
commit
7fd6b3c8c3
@ -49,7 +49,9 @@ class Listen extends Task
|
|||||||
protected function execute(Input $input, Output $output)
|
protected function execute(Input $input, Output $output)
|
||||||
{
|
{
|
||||||
$output->comment('============ 异步任务监听中 ============');
|
$output->comment('============ 异步任务监听中 ============');
|
||||||
cli_set_process_title("ThinkAdmin {$this->version} 异步任务监听主进程");
|
if ($this->isWin() && function_exists('cli_set_process_title')) {
|
||||||
|
cli_set_process_title("ThinkAdmin {$this->version} 异步任务监听主进程");
|
||||||
|
}
|
||||||
while (true) {
|
while (true) {
|
||||||
$map = [['status', 'eq', '1'], ['time', '<=', time()]];
|
$map = [['status', 'eq', '1'], ['time', '<=', time()]];
|
||||||
foreach (Db::name('SystemQueue')->where($map)->order('time asc')->select() as $item) {
|
foreach (Db::name('SystemQueue')->where($map)->order('time asc')->select() as $item) {
|
||||||
|
@ -67,8 +67,10 @@ class Work extends Task
|
|||||||
if (empty($this->id)) throw new Exception("执行任务需要指定任务编号!");
|
if (empty($this->id)) throw new Exception("执行任务需要指定任务编号!");
|
||||||
$queue = Db::name('SystemQueue')->where(['id' => $this->id, 'status' => '2'])->find();
|
$queue = Db::name('SystemQueue')->where(['id' => $this->id, 'status' => '2'])->find();
|
||||||
if (empty($queue)) throw new Exception("执行任务{$this->id}的信息或状态异常!");
|
if (empty($queue)) throw new Exception("执行任务{$this->id}的信息或状态异常!");
|
||||||
|
if ($this->isWin() && function_exists('cli_set_process_title')) {
|
||||||
|
cli_set_process_title("ThinkAdmin {$this->version} 异步任务执行子进程 - {$queue['title']}");
|
||||||
|
}
|
||||||
// 设置进程标题
|
// 设置进程标题
|
||||||
cli_set_process_title("ThinkAdmin {$this->version} 异步任务执行子进程 - {$queue['title']}");
|
|
||||||
// 执行任务内容
|
// 执行任务内容
|
||||||
if (class_exists($queue['preload'])) {
|
if (class_exists($queue['preload'])) {
|
||||||
if (method_exists($class = new $queue['preload'], 'execute')) {
|
if (method_exists($class = new $queue['preload'], 'execute')) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user