From be59c0a49adcb19633c25f3a13894dd4a6b5f6bc Mon Sep 17 00:00:00 2001 From: Dai Date: Wed, 9 Oct 2024 09:51:43 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E5=AD=A6=E7=94=9F=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/StudentHomeworkService.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/common/service/StudentHomeworkService.php b/app/common/service/StudentHomeworkService.php index b28f71a..6bc31e8 100644 --- a/app/common/service/StudentHomeworkService.php +++ b/app/common/service/StudentHomeworkService.php @@ -40,7 +40,12 @@ class StudentHomeworkService $data = $request->post(); - $subject_homework = SubjectHomework::where(['id' => $data['subject_homework_id'], 'is_publish' => 1])->findOrEmpty(); + $student_schedule = StudentSchedule::where(['id' => $data['subject_homework_id']])->findOrEmpty(); + if($student_schedule->isEmpty()){ + throw new Exception('未找到学生排课信息'); + } + + $subject_homework = SubjectHomework::where(['teacher_schedule_time_id' => $student_schedule->teacher_schedule_time_id, 'is_publish' => 1])->findOrEmpty(); if ($subject_homework->isEmpty()) { throw new Exception('老师还未布置课程作业'); }