diff --git a/niucloud/app/api/controller/apiController/PersonCourseSchedule.php b/niucloud/app/api/controller/apiController/PersonCourseSchedule.php index 9b434de2..06b00e1a 100644 --- a/niucloud/app/api/controller/apiController/PersonCourseSchedule.php +++ b/niucloud/app/api/controller/apiController/PersonCourseSchedule.php @@ -108,4 +108,19 @@ class PersonCourseSchedule extends BaseApiService $res = (new PersonCourseScheduleService())->getCalendar($where); return success($res); } + + //获取学生排课的全部场地列表 + public function getVenueListAll(Request $request){ + $resources_id = $request->param('resources_id', '');//客户资源ID + $course_date = $request->param('course_date', '');//上课日期(Y-m-d) + if (empty($resources_id)) { + return fail('缺少参数'); + } + $where = [ + 'resources_id'=>$resources_id, + 'course_date'=>$course_date + ]; + $res = (new PersonCourseScheduleService())->getVenueListAll($where); + return success($res); + } } diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php index aaaf5689..6493c3c0 100644 --- a/niucloud/app/api/route/route.php +++ b/niucloud/app/api/route/route.php @@ -367,6 +367,8 @@ Route::group(function () { Route::post('xy/personCourseSchedule/editStatus', 'apiController.PersonCourseSchedule/editStatus'); //学生端-学生课程安排-获取排课日历 Route::get('xy/personCourseSchedule/getCalendar', 'apiController.PersonCourseSchedule/getCalendar'); + //学生端-学生课程安排-获取学生排课的全部场地列表 + Route::get('xy/personCourseSchedule/getVenueListAll', 'apiController.PersonCourseSchedule/getVenueListAll'); diff --git a/niucloud/app/service/api/apiService/PersonCourseScheduleService.php b/niucloud/app/service/api/apiService/PersonCourseScheduleService.php index 5fa18c15..f5508021 100644 --- a/niucloud/app/service/api/apiService/PersonCourseScheduleService.php +++ b/niucloud/app/service/api/apiService/PersonCourseScheduleService.php @@ -45,7 +45,7 @@ class PersonCourseScheduleService extends BaseApiService //上课日期 if (!empty($where['course_date'])) { - $model = $model->where('course_date', $where['course_date']); + $model = $model->where('school_person_course_schedule.course_date', $where['course_date']); } //判断有没有客户上课状态 @@ -239,4 +239,30 @@ class PersonCourseScheduleService extends BaseApiService } return $result; } + + //获取学生排课的全部场地列表 + public function getVenueListAll(array $where) + { + $schedule_id = PersonCourseSchedule::where('resources_id', $where['resources_id']) + ->where('course_date', $where['course_date']) + ->distinct(true) + ->column('schedule_id'); + + if(!$schedule_id){ + return []; + } + + $venue_id = CourseSchedule::whereIn('id',$schedule_id)->distinct(true)->column('venue_id'); + if(!$venue_id){ + return []; + } + + $res = Venue::whereIn('id',$venue_id) + ->with([ + 'campus' + ]) + ->select()->toArray(); + + return $res; + } }