From 29037ded85c91d9b8f98a0003ca84770e74b14e1 Mon Sep 17 00:00:00 2001 From: Dai Date: Wed, 15 Jan 2025 21:23:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=95=99=E5=B8=88=E6=8E=92=E8=AF=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/service/StudentScheduleService.php | 8 +++++++- .../controller/StudentScheduleController.php | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) 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();