diff --git a/application/admin/queue/task/Listen.php b/application/admin/queue/task/Listen.php index a4c998196..b83562c34 100644 --- a/application/admin/queue/task/Listen.php +++ b/application/admin/queue/task/Listen.php @@ -48,6 +48,7 @@ class Listen extends Task */ protected function execute(Input $input, Output $output) { + Db::name('SystemQueue')->count(); $output->comment('============ 异步任务监听中 ============'); if ($this->isWin() && function_exists('cli_set_process_title')) { cli_set_process_title("ThinkAdmin {$this->version} 异步任务监听主进程"); @@ -60,7 +61,7 @@ class Listen extends Task $command = env('runtime_path') . "queue/{$item['id']}.cmd"; file_exists(dirname($command)) or mkdir(dirname($command), 0755, true); file_put_contents($command, "{$this->bin} xtask:_work {$item['id']} -" . PHP_EOL . 'del %~dp0%0 /y'); - $this->cmd = __DIR__ . DIRECTORY_SEPARATOR . "bin/process.exe {$command}"; + $this->cmd = __DIR__ . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "process.exe {$command}"; } else { $this->cmd = "{$this->bin} xtask:_work {$item['id']} -"; } diff --git a/application/admin/queue/task/Start.php b/application/admin/queue/task/Start.php index 63a76af15..fe029605b 100644 --- a/application/admin/queue/task/Start.php +++ b/application/admin/queue/task/Start.php @@ -18,6 +18,7 @@ namespace app\admin\queue\task; use library\command\Task; use think\console\Input; use think\console\Output; +use think\Db; /** * 检查并创建异步任务监听主进程 @@ -42,6 +43,7 @@ class Start extends Task */ protected function execute(Input $input, Output $output) { + Db::name('SystemQueue')->count(); $this->setBaseProcess(); if (($pid = $this->checkProcess()) > 0) { $output->info("异步任务监听主进程{$pid}已经启动!"); @@ -70,7 +72,7 @@ class Start extends Task $command = env('runtime_path') . "queue" . DIRECTORY_SEPARATOR . "listen.cmd"; file_exists(dirname($command)) or mkdir(dirname($command), 0755, true); file_put_contents($command, $this->cmd . PHP_EOL . 'del %~dp0%0 /y'); - $this->cmd = __DIR__ . DIRECTORY_SEPARATOR . "/bin/process.exe {$command}"; + $this->cmd = __DIR__ . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "process.exe {$command}"; } } }