|
@@ -74,7 +74,15 @@ class ExamPdfExportService
|
|
|
|
|
|
|
|
$version = time();
|
|
$version = time();
|
|
|
$path = "analysis_reports/{$paperId}_{$studentId}_{$version}.pdf";
|
|
$path = "analysis_reports/{$paperId}_{$studentId}_{$version}.pdf";
|
|
|
- Storage::disk('public')->put($path, $pdfBinary);
|
|
|
|
|
|
|
+ Storage::disk('public')->makeDirectory('analysis_reports');
|
|
|
|
|
+ $written = Storage::disk('public')->put($path, $pdfBinary);
|
|
|
|
|
+ if (!$written) {
|
|
|
|
|
+ Log::error('ExamPdfExportService: 保存学情 PDF 失败', [
|
|
|
|
|
+ 'disk' => 'public',
|
|
|
|
|
+ 'path' => $path,
|
|
|
|
|
+ ]);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return URL::to(Storage::url($path));
|
|
return URL::to(Storage::url($path));
|
|
|
} catch (\Throwable $e) {
|
|
} catch (\Throwable $e) {
|
|
@@ -117,7 +125,15 @@ class ExamPdfExportService
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
$path = "exams/{$paperId}_{$suffix}.pdf";
|
|
$path = "exams/{$paperId}_{$suffix}.pdf";
|
|
|
- Storage::disk('public')->put($path, $pdfBinary);
|
|
|
|
|
|
|
+ Storage::disk('public')->makeDirectory('exams');
|
|
|
|
|
+ $written = Storage::disk('public')->put($path, $pdfBinary);
|
|
|
|
|
+ if (!$written) {
|
|
|
|
|
+ Log::error('ExamPdfExportService: 保存 PDF 失败', [
|
|
|
|
|
+ 'disk' => 'public',
|
|
|
|
|
+ 'path' => $path,
|
|
|
|
|
+ ]);
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
return URL::to(Storage::url($path));
|
|
return URL::to(Storage::url($path));
|
|
|
} catch (\Throwable $e) {
|
|
} catch (\Throwable $e) {
|