diff --git a/Server/application/command/TaskSchedulerCommand.php b/Server/application/command/TaskSchedulerCommand.php
index 06a1dbafe..b91bb06d3 100644
--- a/Server/application/command/TaskSchedulerCommand.php
+++ b/Server/application/command/TaskSchedulerCommand.php
@@ -61,10 +61,23 @@ class TaskSchedulerCommand extends Command
$this->maxConcurrent = 1;
}
- // 加载任务配置
+ // 加载任务配置(优先使用框架配置,其次直接引入配置文件,避免加载失败)
$this->tasks = Config::get('task_scheduler', []);
+
+ // 如果通过 Config 没有读到,再尝试直接 include 配置文件
if (empty($this->tasks)) {
- $output->writeln('错误:未找到任务配置');
+ // 以项目根目录为基准查找 config/task_scheduler.php
+ $configFile = dirname(__DIR__, 2) . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'task_scheduler.php';
+ if (is_file($configFile)) {
+ $config = include $configFile;
+ if (is_array($config) && !empty($config)) {
+ $this->tasks = $config;
+ }
+ }
+ }
+
+ if (empty($this->tasks)) {
+ $output->writeln('错误:未找到任务配置(task_scheduler),请检查 config/task_scheduler.php 是否存在且返回数组');
return false;
}