|
|
@@ -65,7 +65,7 @@ class GenerateKnowledgeExplanationPdfJob implements ShouldQueue
|
|
|
'pdfs' => [
|
|
|
'all_pdf' => $pdfUrl,
|
|
|
],
|
|
|
- 'exam_content' => [],
|
|
|
+ 'exam_content' => $this->buildKnowledgeExamContent($record, $pdfUrl),
|
|
|
]);
|
|
|
$taskManager->sendCallback($this->taskId);
|
|
|
} catch (\Throwable $e) {
|
|
|
@@ -124,4 +124,45 @@ class GenerateKnowledgeExplanationPdfJob implements ShouldQueue
|
|
|
]
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+ private function buildKnowledgeExamContent(KnowledgeExplanation $record, string $pdfUrl): array
|
|
|
+ {
|
|
|
+ $paperId = (string) ($record->knowledge_id ?? '');
|
|
|
+ $displayCode = (string) preg_replace('/^(paper_|knowledge_)/', '', $paperId);
|
|
|
+ if ($displayCode === '') {
|
|
|
+ $displayCode = $paperId;
|
|
|
+ }
|
|
|
+ $kpCodes = is_array($record->kp_codes) ? array_values($record->kp_codes) : [];
|
|
|
+
|
|
|
+ return [
|
|
|
+ 'paper_info' => [
|
|
|
+ 'paper_id' => $paperId,
|
|
|
+ 'paper_name' => '知识点讲解_' . $displayCode,
|
|
|
+ 'student_id' => (string) ($record->student_id ?? ''),
|
|
|
+ 'teacher_id' => (string) ($record->teacher_id ?? ''),
|
|
|
+ 'total_questions' => 0,
|
|
|
+ 'total_score' => 0,
|
|
|
+ 'difficulty_category' => null,
|
|
|
+ 'exam_code' => $displayCode,
|
|
|
+ 'grading_code' => null,
|
|
|
+ 'paper_id_num' => $displayCode,
|
|
|
+ ],
|
|
|
+ 'knowledge_points' => $kpCodes,
|
|
|
+ 'statistics' => [
|
|
|
+ 'type_distribution' => [
|
|
|
+ 'choice' => 0,
|
|
|
+ 'fill' => 0,
|
|
|
+ 'answer' => 0,
|
|
|
+ ],
|
|
|
+ 'difficulty_distribution' => [],
|
|
|
+ 'knowledge_point_distribution' => array_fill_keys($kpCodes, 0),
|
|
|
+ 'average_difficulty' => null,
|
|
|
+ 'total_estimated_time' => 0,
|
|
|
+ ],
|
|
|
+ 'pdfs' => [
|
|
|
+ 'all_pdf' => $pdfUrl,
|
|
|
+ ],
|
|
|
+ 'source' => 'knowledge_explanation',
|
|
|
+ ];
|
|
|
+ }
|
|
|
}
|