request->params([ ["campus_id",""], ["name",""], ["emergency_contact",""], ["contact_phone",""], ["created_at",["",""]] ]); return success((new StudentService())->getPage($data)); } /** * 学员详情 * @param int $id * @return \think\Response */ public function info(int $id){ return success((new StudentService())->getInfo($id)); } /** * 添加学员 * @return \think\Response */ public function add(){ $data = $this->request->params([ ["campus_id",0], ["class_id",0], ["user_id",0], ["name",""], ["gender",0], ["age",0.00], ["birthday","2025-05-23 17:31:39"], ["emergency_contact",""], ["contact_phone",""], ["note",""], ["status",0], ]); $this->validate($data, 'app\validate\student\Student.add'); $id = (new StudentService())->add($data); return success('ADD_SUCCESS', ['id' => $id]); } /** * 学员编辑 * @param $id 学员id * @return \think\Response */ public function edit(int $id){ $data = $this->request->params([ ["campus_id",0], ["class_id",0], ["user_id",0], ["name",""], ["gender",0], ["age",0.00], ["birthday","2025-05-23 17:31:39"], ["emergency_contact",""], ["contact_phone",""], ["note",""], ["status",0], ]); $this->validate($data, 'app\validate\student\Student.edit'); (new StudentService())->edit($id, $data); return success('EDIT_SUCCESS'); } /** * 学员删除 * @param $id 学员id * @return \think\Response */ public function del(int $id){ (new StudentService())->del($id); return success('DELETE_SUCCESS'); } public function getCampusAll(){ return success(( new StudentService())->getCampusAll()); } public function getClassGradeAll(){ return success(( new StudentService())->getClassGradeAll()); } public function getMemberAll(){ return success(( new StudentService())->getMemberAll()); } }