|
|
@@ -48,6 +48,17 @@ class ExamPdfExportService
|
|
|
|
|
|
// 生成PDF文件(用于合并,不上传云存储)
|
|
|
$pdfPath = storage_path("app/public/exams/{$paperId}_exam.pdf");
|
|
|
+ $examsDir = storage_path("app/public/exams");
|
|
|
+
|
|
|
+ // 【修复】确保exams目录存在
|
|
|
+ if (!is_dir($examsDir)) {
|
|
|
+ Log::info('ExamPdfExportService: 创建exams目录', ['path' => $examsDir]);
|
|
|
+ if (!mkdir($examsDir, 0755, true)) {
|
|
|
+ Log::error('ExamPdfExportService: 创建exams目录失败', ['path' => $examsDir]);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Log::info('ExamPdfExportService: 开始生成试卷PDF', ['path' => $pdfPath, 'url' => $pageUrl]);
|
|
|
$pdfBinary = $this->buildPdfFromUrl($pageUrl);
|
|
|
if (!$pdfBinary) {
|
|
|
@@ -88,6 +99,17 @@ class ExamPdfExportService
|
|
|
|
|
|
// 生成PDF文件(用于合并,不上传云存储)
|
|
|
$pdfPath = storage_path("app/public/exams/{$paperId}_grading.pdf");
|
|
|
+ $examsDir = storage_path("app/public/exams");
|
|
|
+
|
|
|
+ // 【修复】确保exams目录存在
|
|
|
+ if (!is_dir($examsDir)) {
|
|
|
+ Log::info('ExamPdfExportService: 创建exams目录', ['path' => $examsDir]);
|
|
|
+ if (!mkdir($examsDir, 0755, true)) {
|
|
|
+ Log::error('ExamPdfExportService: 创建exams目录失败', ['path' => $examsDir]);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
Log::info('ExamPdfExportService: 开始生成判卷PDF', ['path' => $pdfPath, 'url' => $pageUrl]);
|
|
|
$pdfBinary = $this->buildPdfFromUrl($pageUrl);
|
|
|
if (!$pdfBinary) {
|