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 +}