getRoleByWhere($where, $offset, $limit); $return['total'] = $user->getAllRole($where); // 总数据 $return['rows'] = $selectResult; json_return(200 , $return , 'success'); } // 添加角色 public function roleAdd() { $param = input('post.'); $validate = new \app\index\validate\RoleValidate; if (!$validate->check($param)) { return json(json_error_exception('1006',$validate->getError())); } $role = new RoleModel(); $flag = $role->insertRole($param); if($flag['code'] != 1){ return json(json_error_exception('1006',$flag['msg'])); } json_return(200,[],'success'); } // 删除角色 public function roleDel() { $id = input('post.id'); $role = new RoleModel(); $flag = $role->delRole($id); if($flag['code'] != 1){ return json(json_error_exception('1006',$flag['msg'])); } $this->removeRoleCache(); json_return(200,[],'success'); } }