Browse Source

修改 bug

develop
王泽彦 4 months ago
parent
commit
9636a2cf2a
  1. 18
      niucloud/app/command/TestCommand.php
  2. 4
      niucloud/app/job/transfer/schedule/CourseScheduleJob.php

18
niucloud/app/command/TestCommand.php

@ -24,8 +24,22 @@ class TestCommand extends Command
protected function execute(Input $input, Output $output) protected function execute(Input $input, Output $output)
{ {
// 指令输出 // 指令输出
$obj = new ResourceAutoAllocation(); $output->writeln('开始测试自动排课任务(包含今天)...');
$obj->doJob();
try {
$obj = new CourseScheduleJob();
$result = $obj->doJob();
if ($result) {
$output->writeln('✅ 自动排课任务执行成功!');
} else {
$output->writeln('❌ 自动排课任务执行失败!');
}
} catch (\Exception $e) {
$output->writeln('❌ 执行异常:' . $e->getMessage());
}
$output->writeln('testcommand'); $output->writeln('testcommand');
} }
} }

4
niucloud/app/job/transfer/schedule/CourseScheduleJob.php

@ -90,8 +90,8 @@ class CourseScheduleJob extends BaseJob
'dates' => [] 'dates' => []
]; ];
// 从天开始,复制到未来指定天数 // 从天开始,复制到未来指定天数
for ($i = 1; $i <= $days; $i++) { for ($i = 0; $i <= $days; $i++) {
// 计算目标日期 // 计算目标日期
$targetDate = date('Y-m-d', strtotime("+{$i} days")); $targetDate = date('Y-m-d', strtotime("+{$i} days"));

Loading…
Cancel
Save