From 301f85e4d87b2b2c6c31362fa1d6d74153ed77e6 Mon Sep 17 00:00:00 2001 From: Dai Date: Thu, 8 Aug 2024 11:10:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E6=8E=92=E8=AF=BE=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=B7=BB=E5=8A=A0=E8=AF=BE=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/model/StudentSchedule.php | 7 ++++++- app/common/service/StudentScheduleService.php | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/common/model/StudentSchedule.php b/app/common/model/StudentSchedule.php index f0f12dc..daa3410 100644 --- a/app/common/model/StudentSchedule.php +++ b/app/common/model/StudentSchedule.php @@ -22,7 +22,7 @@ use support\Model; // */ class StudentSchedule extends BaseModel { - + public function teacher() { return $this->hasOne(Teacher::class, 'id', 'teacher_id')->bind(['teacher_account'=>'account', 'teacher_name']); @@ -38,4 +38,9 @@ class StudentSchedule extends BaseModel return $this->hasOne(Student::class, 'id', 'student_id')->bind(['student_name', 'student_account'=>'account']); } + public function subjectHomeworkArr() + { + return $this->hasOne(SubjectHomework::class, 'teacher_schedule_time_id', 'teacher_schedule_time_id'); + } + } diff --git a/app/common/service/StudentScheduleService.php b/app/common/service/StudentScheduleService.php index 4dba642..fea29a7 100644 --- a/app/common/service/StudentScheduleService.php +++ b/app/common/service/StudentScheduleService.php @@ -45,7 +45,8 @@ class StudentScheduleService $schedule_time->where('date', $data['date']); } - $list = $schedule_time->with(['teacher', 'subject'])->select()->toArray(); + //添加课程作业信息 + $list = $schedule_time->with(['teacher', 'subject', 'subjectHomeworkArr'])->select()->toArray(); return [ 'code' => ResponseCode::SUCCESS, @@ -60,4 +61,4 @@ class StudentScheduleService } } -} \ No newline at end of file +}