diff --git a/niucloud/app/api/controller/apiController/PersonCourseSchedule.php b/niucloud/app/api/controller/apiController/PersonCourseSchedule.php new file mode 100644 index 00000000..df2731ee --- /dev/null +++ b/niucloud/app/api/controller/apiController/PersonCourseSchedule.php @@ -0,0 +1,42 @@ +param('resources_id', '');//客户资源ID + if (empty($resources_id)) { + return fail('缺少参数'); + } + + $where = [ + 'resources_id' => $resources_id, + ]; + + $res = (new PersonCourseScheduleService())->getList($where); + + return success($res); + } +} diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php index 1b85f92c..79593a19 100644 --- a/niucloud/app/api/route/route.php +++ b/niucloud/app/api/route/route.php @@ -358,6 +358,11 @@ Route::group(function () { //学生端-体测报告-详情 Route::get('xy/physicalTest/info', 'apiController.PhysicalTest/info'); + //学生端-学生课程安排-列表 + Route::get('xy/personCourseSchedule', 'apiController.PersonCourseSchedule/index'); + //学生端-学生课程安排-详情 + Route::get('xy/personCourseSchedule/info', 'apiController.PersonCourseSchedule/info'); + diff --git a/niucloud/app/service/api/apiService/PersonCourseScheduleService.php b/niucloud/app/service/api/apiService/PersonCourseScheduleService.php new file mode 100644 index 00000000..8d5d7538 --- /dev/null +++ b/niucloud/app/service/api/apiService/PersonCourseScheduleService.php @@ -0,0 +1,98 @@ +getPageParam();//获取请求参数中的页码+分页数 + $page = $page_params['page']; + $limit = $page_params['limit']; + + $model = new PersonCourseSchedule(); + //判断有没有客户资源id + if (!empty($where['resources_id'])) { + $model = $model->where('resources_id', $where['resources_id']); + } + $schedule_id = $model->distinct(true)->column('schedule_id');//课程安排id + if(!$schedule_id){ + return []; + } + + $data = CourseSchedule::whereIn('id', $schedule_id) + ->order('course_date','desc') + ->with([ + 'venue',//场地 + 'campus',//校区 + 'course',//课程 + ]) + + ->paginate([ + 'list_rows' => $limit, + 'page' => $page, + ])->toArray(); + + + + return $data; + } + + //查询详情 + public function getTestInfo(array $where) + { + $model = new ChatFriends(); + //判断用没有员工id + if (!empty($where['personnel_id'])) { + $model = $model->where('personnel_id', $where['personnel_id']); + } + if (!empty($where['customer_resources_id'])) { + $model = $model->where('customer_resources_id', $where['customer_resources_id']); + } + $data = $model->find(); + + + if ($data) { + $data = $data->toArray(); + $res = [ + 'code' => 1, + 'msg' => '操作成功', + 'data' => $data + ]; + return $res; + } else { + $res = [ + 'code' => 0, + 'msg' => '暂无数据', + 'data' => [] + ]; + return $res; + } + } +}