request->params([ ["campus_id",""], ["name",""], ["emergency_contact",""], ["contact_phone",""], ["created_at",[]], ['member_label', 0], ["class_id",""] ]); 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([ ["user_id",0], ["campus_id",0], ["class_id",0], ["name",""], ["gender",0], ["age",0.00], ["birthday","2025-05-26 16:25:55"], ["emergency_contact",""], ["contact_phone",""], ["note",""], ["status",0], ['member_label', []], ]); $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([ ["user_id",0], ["campus_id",0], ["class_id",0], ["name",""], ["gender",0], ["age",0.00], ["birthday","2025-05-26 16:25:55"], ["emergency_contact",""], ["contact_phone",""], ["note",""], ["status",0], ['member_label', []], ]); $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 getCustomerResourcesAll(){ $params = $this->request->params([ ["name", ""], ["phone_number", ""] ]); return success(( new StudentService())->getCustomerResourcesAll($params)); } public function getCampusAll(){ return success(( new StudentService())->getCampusAll()); } public function getClassGradeAll(){ return success(( new StudentService())->getClassGradeAll()); } public function label_all() { return success(( new StudentService() )->label_all()); } /** * 通过名称查询学员 */ public function getStudentByName() { $data = $this->request->params([ ["name", ""], ]); $list = (new StudentService())->getStudentByName($data['name']); return success($list); } }