From 7e801a4dcafdb39af0ea5b3fb140318fbea5c6cf Mon Sep 17 00:00:00 2001 From: liutong <836164388@qq.com> Date: Thu, 5 Jun 2025 16:06:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(api):=20=E6=B7=BB=E5=8A=A0=E4=BD=93?= =?UTF-8?q?=E6=B5=8B=E6=8A=A5=E5=91=8A=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=92=8C=E4=B8=9A=E5=8A=A1=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 PhysicalTest 控制器,提供体测报告相关接口 - 实现 PhysicalTestService 和 TestService 服务类,处理体测报告业务逻辑 - 添加体测报告列表和详情查询功能 --- .../controller/apiController/PhysicalTest.php | 46 +++++++++ .../api/apiService/PhysicalTestService.php | 95 +++++++++++++++++++ .../service/api/apiService/TestService.php | 95 +++++++++++++++++++ 3 files changed, 236 insertions(+) create mode 100644 niucloud/app/api/controller/apiController/PhysicalTest.php create mode 100644 niucloud/app/service/api/apiService/PhysicalTestService.php create mode 100644 niucloud/app/service/api/apiService/TestService.php diff --git a/niucloud/app/api/controller/apiController/PhysicalTest.php b/niucloud/app/api/controller/apiController/PhysicalTest.php new file mode 100644 index 00000000..340d7423 --- /dev/null +++ b/niucloud/app/api/controller/apiController/PhysicalTest.php @@ -0,0 +1,46 @@ +param('personnel_id', '');//员工人力资源表id(两个参数2选1) + $customer_resources_id = $request->param('customer_resources_id', '');//学生资源表id(两个参数2选1) + if (empty($personnel_id) && empty($customer_resources_id)) { + return fail('缺少参数'); + } + + $where = [ + 'personnel_id' => $personnel_id, + 'customer_resources_id' => $customer_resources_id, + ]; + + $res = (new ChatService())->getChatFriendsPage($where); + + return success($res); + } +} diff --git a/niucloud/app/service/api/apiService/PhysicalTestService.php b/niucloud/app/service/api/apiService/PhysicalTestService.php new file mode 100644 index 00000000..04254c09 --- /dev/null +++ b/niucloud/app/service/api/apiService/PhysicalTestService.php @@ -0,0 +1,95 @@ +getPageParam();//获取请求参数中的页码+分页数 + $page = $page_params['page']; + $limit = $page_params['limit']; + + $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 + ->with([ + 'personnel', + 'customer', + ]) + ->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; + } + } +} diff --git a/niucloud/app/service/api/apiService/TestService.php b/niucloud/app/service/api/apiService/TestService.php new file mode 100644 index 00000000..81629665 --- /dev/null +++ b/niucloud/app/service/api/apiService/TestService.php @@ -0,0 +1,95 @@ +getPageParam();//获取请求参数中的页码+分页数 + $page = $page_params['page']; + $limit = $page_params['limit']; + + $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 + ->with([ + 'personnel', + 'customer', + ]) + ->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; + } + } +}