getPage(); $keywords = $this->request->get('keywords'); $result = RoleServer::getRoleList($page, $limit, $keywords); return json_success($result, '成功'); } /** * Notes:获取所有角色 * @return \support\Response * User: ZQ * Date: 2022/9/19 */ public function getRoleAll() { $result = RoleServer::getRoleAll(); return json_success($result, '成功'); } /** * Notes:修改角色 * @return \support\Response * User: ZQ * Date: 2022/9/13 */ public function updateRole() { $role_id = $this->request->post('role_id'); $role_name = $this->request->post('role_name',''); $role_rules = $this->request->post('role_rules',''); $role_info = $this->request->post('role_info',''); $role_is_show = $this->request->post('role_is_show'); $this->validateCheck('role\RoleValidate', ['role_id' => $role_id, 'role_name' => $role_name, 'role_rules' => $role_rules], 'update'); $result = RoleServer::updateRole($role_id, $role_name, $role_rules, $role_info, $role_is_show); return json_success($result, '修改成功'); } /** * Notes:删除角色 * @return \support\Response * User: ZQ * Date: 2022/9/13 */ public function delRole() { $role_id = $this->request->get('role_id'); $this->validateCheck('role\RoleValidate', ['role_id' => $role_id], 'info'); $result = RoleServer::delRole($role_id); if ($result){ return json_success($result, '删除成功'); }else{ throw new \Exception('删除失败!'); } } /** * Notes:添加角色 * @return \support\Response * User: ZQ * Date: 2022/9/13 */ public function addRole() { $role_name = $this->request->post('role_name'); $role_rules = $this->request->post('role_rules',''); $role_info = $this->request->post('role_info',''); $role_is_show = $this->request->post('role_is_show'); $this->validateCheck('role\RoleValidate', ['role_name' => $role_name, 'role_rules' => $role_rules, 'role_is_show' => $role_is_show], 'create'); $result = RoleServer::insertRole($role_name, $role_rules, $role_info, $role_is_show); return json_success($result, '添加成功'); } /** * Notes:查询角色详情 * @return \support\Response * User: ZQ * Date: 2022/9/13 */ public function roleInfo() { $role_id = $this->request->get('role_id'); $this->validateCheck('role\RoleValidate', ['role_id' => $role_id], 'info'); $result = RoleServer::roleInfo($role_id); return json_success($result, '成功'); } /** * Notes:角色启用禁用 * @return \support\Response * User: ZQ * Date: 2022/9/13 */ public function updateStatus() { $role_id = $this->request->get('role_id'); $role_is_show = $this->request->get('role_is_show'); $this->validateCheck('role\RoleValidate', ['role_id' => $role_id], 'info'); $result = RoleServer::updateStatus($role_id, $role_is_show); return json_success($result, '修改成功'); } }