diff --git a/niucloud/app/command/TestCommand.php b/niucloud/app/command/TestCommand.php index 72ad4814..5f1e84c5 100755 --- a/niucloud/app/command/TestCommand.php +++ b/niucloud/app/command/TestCommand.php @@ -24,8 +24,22 @@ class TestCommand extends Command protected function execute(Input $input, Output $output) { // 指令输出 - $obj = new ResourceAutoAllocation(); - $obj->doJob(); + $output->writeln('开始测试自动排课任务(包含今天)...'); + + try { + $obj = new CourseScheduleJob(); + $result = $obj->doJob(); + + if ($result) { + $output->writeln('✅ 自动排课任务执行成功!'); + } else { + $output->writeln('❌ 自动排课任务执行失败!'); + } + + } catch (\Exception $e) { + $output->writeln('❌ 执行异常:' . $e->getMessage()); + } + $output->writeln('testcommand'); } } diff --git a/niucloud/app/job/transfer/schedule/CourseScheduleJob.php b/niucloud/app/job/transfer/schedule/CourseScheduleJob.php index 8a83e6ee..816a31ac 100755 --- a/niucloud/app/job/transfer/schedule/CourseScheduleJob.php +++ b/niucloud/app/job/transfer/schedule/CourseScheduleJob.php @@ -90,8 +90,8 @@ class CourseScheduleJob extends BaseJob 'dates' => [] ]; - // 从明天开始,复制到未来指定天数 - for ($i = 1; $i <= $days; $i++) { + // 从今天开始,复制到未来指定天数 + for ($i = 0; $i <= $days; $i++) { // 计算目标日期 $targetDate = date('Y-m-d', strtotime("+{$i} days"));