From 727f977e86cfaf0a0485167de1e7468b5393d0c4 Mon Sep 17 00:00:00 2001 From: liutong <836164388@qq.com> Date: Tue, 10 Jun 2025 13:41:35 +0800 Subject: [PATCH] =?UTF-8?q?(apifeat):=20=E6=B7=BB=E5=8A=A0=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=AD=A6=E7=94=9F=E6=8E=92=E8=AF=BE=E6=95=99=E7=BB=83?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 PersonCourseSchedule 控制器中添加 getMyCoach 方法 - 在 PersonCourseScheduleService 服务中实现 memberCoachList 方法 - 在路由中添加相应 API 路由 --- .../apiController/PersonCourseSchedule.php | 16 ++++++++ niucloud/app/api/route/route.php | 2 + .../PersonCourseScheduleService.php | 38 +++++++++++++++++++ 3 files changed, 56 insertions(+) diff --git a/niucloud/app/api/controller/apiController/PersonCourseSchedule.php b/niucloud/app/api/controller/apiController/PersonCourseSchedule.php index 06b00e1a..e593fe17 100644 --- a/niucloud/app/api/controller/apiController/PersonCourseSchedule.php +++ b/niucloud/app/api/controller/apiController/PersonCourseSchedule.php @@ -123,4 +123,20 @@ class PersonCourseSchedule extends BaseApiService $res = (new PersonCourseScheduleService())->getVenueListAll($where); return success($res); } + + //获取学生排课的教练列表 + public function getMyCoach(Request $request){ + $resources_id = $request->param('resources_id', '');//客户资源ID + if (empty($resources_id)) { + return fail('缺少参数'); + } + $where = [ + 'resources_id'=>$resources_id, + ]; + $res = (new PersonCourseScheduleService())->memberCoachList($where); + if(!$res['code']){ + return fail($res['msg']); + } + return success($res['data']); + } } diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php index 6493c3c0..20b6179b 100644 --- a/niucloud/app/api/route/route.php +++ b/niucloud/app/api/route/route.php @@ -369,6 +369,8 @@ Route::group(function () { Route::get('xy/personCourseSchedule/getCalendar', 'apiController.PersonCourseSchedule/getCalendar'); //学生端-学生课程安排-获取学生排课的全部场地列表 Route::get('xy/personCourseSchedule/getVenueListAll', 'apiController.PersonCourseSchedule/getVenueListAll'); + //学生端-学生课程安排-我的教练列表 + Route::get('xy/personCourseSchedule/getMyCoach', 'apiController.PersonCourseSchedule/getMyCoach'); diff --git a/niucloud/app/service/api/apiService/PersonCourseScheduleService.php b/niucloud/app/service/api/apiService/PersonCourseScheduleService.php index f5508021..3a553dd3 100644 --- a/niucloud/app/service/api/apiService/PersonCourseScheduleService.php +++ b/niucloud/app/service/api/apiService/PersonCourseScheduleService.php @@ -14,6 +14,7 @@ namespace app\service\api\apiService; use app\model\chat_friends\ChatFriends; use app\model\course_schedule\CourseSchedule; use app\model\person_course_schedule\PersonCourseSchedule; +use app\model\personnel\Personnel; use app\model\venue\Venue; use core\base\BaseApiService; use think\facade\Db; @@ -265,4 +266,41 @@ class PersonCourseScheduleService extends BaseApiService return $res; } + + //获取学生排课的教练列表 + public function memberCoachList(array $where) + { + $page_params = $this->getPageParam();//获取请求参数中的页码+分页数 + $page = $page_params['page']; + $limit = $page_params['limit']; + + $res = [ + 'code' => 0, + 'msg' => '暂无课程安排', + 'data' => [] + ]; + + $schedule_id = PersonCourseSchedule::where('resources_id', $where['resources_id'])->distinct(true)->column('schedule_id'); + if(!$schedule_id){ + return $res; + } + $coach_id = CourseSchedule::whereIn('id',$schedule_id)->distinct(true)->column('coach_id'); + if(!$coach_id){ + return $res; + } + + $data = Personnel::whereIn('id', $coach_id) + ->paginate([ + 'list_rows' => $limit, + 'page' => $page, + ]) + ->toArray(); + $res = [ + 'code' => 1, + 'msg' => '操作成功', + 'data' => $data + ]; + return $res; + + } }