ReportTeacherWeeklyPdfCommand.php 734 B

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace App\Console\Commands;
  3. use Illuminate\Console\Command;
  4. class ReportTeacherWeeklyPdfCommand extends Command
  5. {
  6. protected $signature = 'report:teacher-weekly-pdf';
  7. protected $description = '生成老师组卷与学情分析周报 PDF(文件名带日期与时间戳 teacher-weekly-stats-Y-m-d_His.pdf)';
  8. public function handle(): int
  9. {
  10. $script = base_path('scripts/report_teacher_weekly_stats_pdf.php');
  11. if (! is_file($script)) {
  12. $this->error('找不到脚本:'.$script);
  13. return self::FAILURE;
  14. }
  15. passthru(escapeshellarg(PHP_BINARY).' '.escapeshellarg($script), $code);
  16. return $code === 0 ? self::SUCCESS : self::FAILURE;
  17. }
  18. }