购物车和订单中心以及优惠券相关功能初版
This commit is contained in:
+8
-7
@@ -39,17 +39,17 @@ public class AuthGlobalFilter implements GlobalFilter, Ordered {
|
||||
ServerHttpRequest request = exchange.getRequest();
|
||||
String path = request.getURI().getPath();
|
||||
|
||||
log.info("网关接收到请求: {}", path);
|
||||
log.info("Gateway received request: {}", path);
|
||||
|
||||
// 1. 白名单校验(登录和注册接口不需要认证)
|
||||
log.info("检查路径是否在白名单中: {}", path);
|
||||
// 1. Whitelist check (login and register interfaces don't need authentication)
|
||||
log.info("Checking if path is in whitelist: {}", path);
|
||||
boolean isWhitelist = isWhitelist(path);
|
||||
log.info("白名单校验结果: {}", isWhitelist);
|
||||
log.info("Whitelist check result: {}", isWhitelist);
|
||||
if (isWhitelist) {
|
||||
log.info("路径在白名单中,直接放行");
|
||||
log.info("Path is in whitelist, passing through directly");
|
||||
return chain.filter(exchange);
|
||||
}
|
||||
log.info("路径不在白名单中,需要进行Token校验");
|
||||
log.info("Path is not in whitelist, need to check Token");
|
||||
|
||||
// 2. Token 校验
|
||||
String token = request.getHeaders().getFirst("Authorization");
|
||||
@@ -75,7 +75,8 @@ public class AuthGlobalFilter implements GlobalFilter, Ordered {
|
||||
path.equals("/api/user/register") ||
|
||||
path.equals("/api/user/refresh-token") ||
|
||||
path.equals("/api/shop/list/simple") ||
|
||||
path.equals("/api/admin/auth/login");
|
||||
path.equals("/api/admin/auth/login") ||
|
||||
path.contains("/api/user/get/account");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,6 +57,18 @@ spring:
|
||||
- Path=/api/coupon/**
|
||||
filters:
|
||||
- RewritePath=/api/(?<remaining>.*), /${remaining}
|
||||
- id: cart-route
|
||||
uri: lb://yumi-nail-core
|
||||
predicates:
|
||||
- Path=/api/cart/**
|
||||
filters:
|
||||
- RewritePath=/api/(?<remaining>.*), /${remaining}
|
||||
- id: order-route
|
||||
uri: lb://yumi-nail-core
|
||||
predicates:
|
||||
- Path=/api/order/**
|
||||
filters:
|
||||
- RewritePath=/api/(?<remaining>.*), /${remaining}
|
||||
# 后台管理API路由
|
||||
- id: admin-route
|
||||
uri: lb://yumi-nail-core
|
||||
|
||||
Reference in New Issue
Block a user