Selaa lähdekoodia

fix: paper里的章节信息没有记录

gwd 1 viikko sitten
vanhempi
commit
823057eeb8

+ 10 - 0
app/Http/Controllers/Api/IntelligentExamController.php

@@ -152,6 +152,9 @@ class IntelligentExamController extends Controller
         try {
         try {
             $questions = [];
             $questions = [];
             $result = null;
             $result = null;
+            // 【新增】初始化章节摸底和智能组卷的关键字段
+            $diagnosticChapterId = null;
+            $explanationKpCodes = null;
 
 
             if (! empty($mistakeIds) || ! empty($mistakeQuestionIds)) {
             if (! empty($mistakeIds) || ! empty($mistakeQuestionIds)) {
                 $questionIds = $this->resolveMistakeQuestionIds(
                 $questionIds = $this->resolveMistakeQuestionIds(
@@ -227,6 +230,10 @@ class IntelligentExamController extends Controller
                     $difficultyCategory = $result['stats']['difficulty_category'];
                     $difficultyCategory = $result['stats']['difficulty_category'];
                 }
                 }
 
 
+                // 【新增】提取章节摸底和智能组卷的关键字段
+                $diagnosticChapterId = $result['diagnostic_chapter_id'] ?? null;
+                $explanationKpCodes = $result['explanation_kp_codes'] ?? null;
+
                 $questions = $this->hydrateQuestions($result['questions'] ?? [], $data['kp_codes']);
                 $questions = $this->hydrateQuestions($result['questions'] ?? [], $data['kp_codes']);
             }
             }
 
 
@@ -266,6 +273,9 @@ class IntelligentExamController extends Controller
                 'difficulty_category' => $difficultyCategory,
                 'difficulty_category' => $difficultyCategory,
                 'total_score' => $totalScore, // 使用计算后的实际总分
                 'total_score' => $totalScore, // 使用计算后的实际总分
                 'questions' => $questions,
                 'questions' => $questions,
+                // 【新增】章节摸底和智能组卷的关键字段
+                'diagnostic_chapter_id' => $diagnosticChapterId ?? null,
+                'explanation_kp_codes' => $explanationKpCodes ?? null,
             ]);
             ]);
 
 
             if (! $paperId) {
             if (! $paperId) {

+ 3 - 0
app/Services/LearningAnalyticsService.php

@@ -1605,6 +1605,9 @@ class LearningAnalyticsService
                 'success' => true,
                 'success' => true,
                 'message' => '智能出卷成功',
                 'message' => '智能出卷成功',
                 'questions' => $selectedQuestions,
                 'questions' => $selectedQuestions,
+                // 【新增】传递章节摸底和智能组卷的关键字段
+                'diagnostic_chapter_id' => $params['diagnostic_chapter_id'] ?? null,
+                'explanation_kp_codes' => $params['explanation_kp_codes'] ?? null,
                 'stats' => [
                 'stats' => [
                     'total_selected' => count($selectedQuestions),
                     'total_selected' => count($selectedQuestions),
                     'source_questions' => count($allQuestions),
                     'source_questions' => count($allQuestions),