This commit is contained in:
wong
2025-12-01 16:46:23 +08:00
parent 33cd4de3c5
commit ff7097f2d9

View File

@@ -81,8 +81,8 @@ class TaskSchedulerCommand extends Command
return false;
}
// 设置日志目录
$this->logDir = runtime_path() . 'log' . DIRECTORY_SEPARATOR;
// 设置日志目录(注意要使用全局函数,避免命名空间影响)
$this->logDir = \runtime_path() . 'log' . DIRECTORY_SEPARATOR;
if (!is_dir($this->logDir)) {
mkdir($this->logDir, 0755, true);
}
@@ -333,7 +333,8 @@ class TaskSchedulerCommand extends Command
}
// 构建命令
$thinkPath = root_path() . 'think';
// 使用项目根目录下的 think 脚本(同命令行 php think
$thinkPath = \root_path() . 'think';
$command = "php {$thinkPath} {$task['command']}";
if (!empty($task['options'])) {
foreach ($task['options'] as $option) {