Bladeren bron

fix: api/exam-answer-analysis 接口支持传递空数组,代表没有错题,所有的学案题目是对的

过卫栋 1 maand geleden
bovenliggende
commit
fff5c0bbc9
1 gewijzigde bestanden met toevoegingen van 1 en 1 verwijderingen
  1. 1 1
      app/Http/Controllers/Api/ExamAnswerAnalysisController.php

+ 1 - 1
app/Http/Controllers/Api/ExamAnswerAnalysisController.php

@@ -38,7 +38,7 @@ class ExamAnswerAnalysisController extends Controller
             $validator = Validator::make($request->all(), [
                 'paper_id' => 'required|string|max:255',
                 'student_id' => 'required|numeric',
-                'questions' => 'required|array|min:1',
+                'questions' => 'required|array',  // 允许空数组(全对时前端只传错题,全对则为空)
                 'questions.*.question_bank_id' => 'required|numeric',
                 'questions.*.student_answer' => 'sometimes|string',
                 'questions.*.is_correct' => 'sometimes|array',