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();