From 75afc844b9928b047a510423ec8892f46764c438 Mon Sep 17 00:00:00 2001 From: liutong <836164388@qq.com> Date: Wed, 11 Jun 2025 20:10:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(api):=20=E4=BF=AE=E5=A4=8D=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E8=B5=84=E6=BA=90=E6=89=8B=E6=9C=BA=E5=8F=B7=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E6=B7=BB=E5=8A=A0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在添加客户资源前增加手机号存在性检查- 通过修改 CustomerResourcesService 类实现手机号查询功能 --- .../controller/apiController/Assignment.php | 19 +++++++++++++++ niucloud/app/api/route/route.php | 3 +++ .../api/apiService/AssignmentService.php | 24 ++++++++++++------- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/niucloud/app/api/controller/apiController/Assignment.php b/niucloud/app/api/controller/apiController/Assignment.php index 13e337d6..80aec267 100644 --- a/niucloud/app/api/controller/apiController/Assignment.php +++ b/niucloud/app/api/controller/apiController/Assignment.php @@ -72,4 +72,23 @@ class Assignment extends BaseApiService return success([$res['data']]); } + + //学生作业详情 + public function info(Request $request) + { + $id = $request->param('id', '');//作业表id + if(empty($id)){ + return fail('缺少参数'); + } + + $where = [ + 'id'=>$id, + ]; + $res = (new AssignmentService())->getInfo($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 61a001ba..8d542f04 100644 --- a/niucloud/app/api/route/route.php +++ b/niucloud/app/api/route/route.php @@ -379,7 +379,10 @@ Route::group(function () { //学生端-学生作业-作业列表 Route::get('xy/assignment', 'apiController.Assignment/index'); + //学生端-提交作业 Route::get('xy/assignment/submitObj', 'apiController.Assignment/submitObj'); + //学生端-作业详情 + Route::get('xy/assignment/info', 'apiController.Assignment/info'); diff --git a/niucloud/app/service/api/apiService/AssignmentService.php b/niucloud/app/service/api/apiService/AssignmentService.php index 02c87a4a..d4b91740 100644 --- a/niucloud/app/service/api/apiService/AssignmentService.php +++ b/niucloud/app/service/api/apiService/AssignmentService.php @@ -100,18 +100,24 @@ class AssignmentService extends BaseApiService } //查询详情 - public function getTestInfo(array $where) + public function getInfo(array $where) { - $model = new ChatFriends(); - //判断用没有员工id - if (!empty($where['personnel_id'])) { - $model = $model->where('personnel_id', $where['personnel_id']); + $model = new Assignment(); + if (!empty($where['id'])) { + $model = $model->where('id', $where['id']); } - if (!empty($where['customer_resources_id'])) { - $model = $model->where('customer_resources_id', $where['customer_resources_id']); - } - $data = $model->find(); + $data = $model->with([ + 'student' => function ($query) { + $query->with([ + 'customerResources' => function ($query2) { + $query2->with([ + 'member' + ]); + } + ]); + }, + ])->find(); if ($data) { $data = $data->toArray();