diff --git a/niucloud/app/api/controller/apiController/Assignment.php b/niucloud/app/api/controller/apiController/Assignment.php new file mode 100644 index 00000000..7021a5dd --- /dev/null +++ b/niucloud/app/api/controller/apiController/Assignment.php @@ -0,0 +1,47 @@ +param('resources_id', '');//学生资源表id + $status = $request->param('status', '');//状态 1待批改 2未提交 3已提交 + if (empty($resources_id)) { + return fail('缺少参数'); + } + + $where = [ + 'resources_id' => $resources_id, + 'status' => $status, + ]; + + $res = (new AssignmentService())->getList($where); + + return success($res); + } +} diff --git a/niucloud/app/api/route/route.php b/niucloud/app/api/route/route.php index 9bd2d779..b8c870f9 100644 --- a/niucloud/app/api/route/route.php +++ b/niucloud/app/api/route/route.php @@ -374,6 +374,9 @@ Route::group(function () { //学生端-学生课程安排-学员课时消费记录 Route::get('xy/personCourseSchedule/getStudentCourseUsageList', 'apiController.PersonCourseSchedule/getStudentCourseUsageList'); + //学生端-学生作业-作业列表 + Route::get('xy/assignment', 'apiController.Assignment/index'); + diff --git a/niucloud/app/model/assignment/Assignment.php b/niucloud/app/model/assignment/Assignment.php index e61c6873..facc8ebc 100644 --- a/niucloud/app/model/assignment/Assignment.php +++ b/niucloud/app/model/assignment/Assignment.php @@ -9,7 +9,7 @@ // | Author: Niucloud Team // +---------------------------------------------------------------------- -namespace app\model\Assignment; +namespace app\model\assignment; use core\base\BaseModel; use think\model\concern\SoftDelete; diff --git a/niucloud/app/service/api/apiService/AssignmentService.php b/niucloud/app/service/api/apiService/AssignmentService.php new file mode 100644 index 00000000..2d1e023b --- /dev/null +++ b/niucloud/app/service/api/apiService/AssignmentService.php @@ -0,0 +1,105 @@ +getPageParam();//获取请求参数中的页码+分页数 + $page = $page_params['page']; + $limit = $page_params['limit']; + $student_id = Student::where('id',$where['resources_id'])->value('id');//学生id + $data = Assignment::where('student_id',$student_id); + if(!empty($where['status'])){ + $data = $data->where('status',$where['status']); + } + + $data = $data + ->order('created_at', 'desc') + ->with([ + 'student' => function ($query) { + $query->with([ + 'customerResources' => function ($query2) { + $query2->with([ + 'member' + ]); + } + ]); + }, + ]) + ->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; + } + } +}