request->params([ ["campus_id",""], ["person_name",""], ["role_id",""], ["dept_id",""] ]); return success((new CampusPersonRoleService())->getPage($data)); } /** * 角色关系详情 * @param int $id * @return \think\Response */ public function info(int $id){ return success((new CampusPersonRoleService())->getInfo($id)); } /** * 添加角色关系 * @return \think\Response */ public function add(){ $data = $this->request->params([ ["campus_id",0], ["person_id",0], ["role_id",0], ["dept_id",0], ]); $this->validate($data, 'app\validate\campus_person_role\CampusPersonRole.add'); return (new CampusPersonRoleService())->add($data); } /** * 角色关系编辑 * @param $id 角色关系id * @return \think\Response */ public function edit(int $id){ $data = $this->request->params([ ["campus_id",0], ["person_id",0], ["role_id",0], ["dept_id",0], ["tasks",''] ]); $this->validate($data, 'app\validate\campus_person_role\CampusPersonRole.edit'); return (new CampusPersonRoleService())->edit($id, $data); } /** * 角色关系删除 * @param $id 角色关系id * @return \think\Response */ public function del(int $id){ (new CampusPersonRoleService())->del($id); return success('DELETE_SUCCESS'); } public function getCampusAll(){ return success(( new CampusPersonRoleService())->getCampusAll()); } public function getPersonnelAll(){ return success(( new CampusPersonRoleService())->getPersonnelAll()); } public function getSysRoleAll(){ $data = $this->request->params([ ["dept_id",0] ]); return success(( new CampusPersonRoleService())->getSysRoleAll($data)); } public function getDepartmentsAll(){ return success(( new CampusPersonRoleService())->getDepartmentsAll()); } }