diff --git a/Server/application/command/TaskSchedulerCommand.php b/Server/application/command/TaskSchedulerCommand.php index 3e6edba2..943bfbfc 100644 --- a/Server/application/command/TaskSchedulerCommand.php +++ b/Server/application/command/TaskSchedulerCommand.php @@ -396,13 +396,14 @@ class TaskSchedulerCommand extends Command mkdir($logDir, 0755, true); } - // 使用指定的网站目录作为执行目录 - $executionPath = '/www/wwwroot/mckb_quwanzhi_com/Server'; + // 获取项目根目录(使用 __DIR__ 动态获取) + // TaskSchedulerCommand.php 位于 application/command/,向上两级到项目根目录 + $executionPath = dirname(__DIR__, 2); // 获取 PHP 可执行文件路径 $phpPath = PHP_BINARY ?: 'php'; - // 获取 think 脚本路径(使用执行目录) + // 获取 think 脚本路径(使用项目根目录) $thinkPath = $executionPath . DIRECTORY_SEPARATOR . 'think'; // 检查 think 文件是否存在 diff --git a/Server/config/task_scheduler.php b/Server/config/task_scheduler.php index eab1e5b7..8e189c55 100644 --- a/Server/config/task_scheduler.php +++ b/Server/config/task_scheduler.php @@ -142,7 +142,7 @@ return [ 'command' => 'content:collect', 'schedule' => '*/5 * * * *', // 每5分钟 'options' => [], - 'enabled' => true, + 'enabled' => false, 'max_concurrent' => 1, 'log_file' => 'crontab_contentCollect.log', ],