💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
```java @Slf4j @Component public class MyGateWayFilter implements GlobalFilter, Ordered { @Override public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) { log.info("MyGateWayFilter: " + new Date()); //请求必须携带参数 uname 才允许通过 String uname = exchange.getRequest().getQueryParams().getFirst("uname"); if (uname == null) { log.info("用户名为空,非法用户。"); exchange.getResponse().setStatusCode(HttpStatus.NOT_ACCEPTABLE); return exchange.getResponse().setComplete(); } return chain.filter(exchange); } @Override public int getOrder() { return 0; } } ``` http://localhost:9527/payment/get/uname?uname=zhangsan ``` serverPort:8002,uname=zhangsan ```