diff --git a/app/common/service/StudentScheduleService.php b/app/common/service/StudentScheduleService.php index fea29a7..af1d63d 100644 --- a/app/common/service/StudentScheduleService.php +++ b/app/common/service/StudentScheduleService.php @@ -46,7 +46,13 @@ class StudentScheduleService } //添加课程作业信息 - $list = $schedule_time->with(['teacher', 'subject', 'subjectHomeworkArr'])->select()->toArray(); + $list = $schedule_time->with(['teacher', 'subject', 'subjectHomeworkArr']) + ->fetchSql(true) + ->select(); +// ->toArray(); + print '
';
+            print_r($list);
+            die;
 
             return [
                 'code' => ResponseCode::SUCCESS,
diff --git a/plugin/admin/app/controller/StudentScheduleController.php b/plugin/admin/app/controller/StudentScheduleController.php
index 01e3553..20cb3aa 100644
--- a/plugin/admin/app/controller/StudentScheduleController.php
+++ b/plugin/admin/app/controller/StudentScheduleController.php
@@ -159,6 +159,25 @@ class StudentScheduleController extends Crud
     public function update(Request $request): Response
     {
         if ($request->method() === 'POST') {
+            $data = $request->post();
+            if(isset($data['is_publish']) && $data['is_publish'] == 1){
+                $student_schedule = \app\common\model\StudentSchedule::where(['id' => $data['id']])->find();
+                //查找教师课程是否发布,未发布提示先发布教师课程
+                $teacher_schedule_time = TeacherScheduleTime::where(['id'=>$student_schedule['teacher_schedule_time_id']])->findOrEmpty();
+                if($teacher_schedule_time->isEmpty()){
+                    return json([
+                        'code' => ResponseCode::WEB_API_FAIL,
+                        'msg' => '教师排课不存在'
+                    ]);
+                }
+                if($teacher_schedule_time->is_publish != 1){
+                    return json([
+                        'code' => ResponseCode::WEB_API_FAIL,
+                        'msg' => '请先发布教师排课'
+                    ]);
+                }
+            }
+
             $result = parent::update($request);
 
             $data = $request->post();