From 9636a2cf2a1d986857f3d5e8fc0ffd0c25b55591 Mon Sep 17 00:00:00 2001 From: zeyan <258785420@qq.com> Date: Mon, 8 Dec 2025 15:05:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- niucloud/app/command/TestCommand.php | 18 ++++++++++++++++-- .../transfer/schedule/CourseScheduleJob.php | 4 ++-- 2 files changed, 18 insertions(+), 4 deletions(-) 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"));