Compare commits

..

4 Commits

Author SHA1 Message Date
6bfc845693 放行 2025-10-23 23:14:22 +08:00
6b50bfaeb4 notify 2025-09-29 02:21:28 +08:00
50f3579f6a Merge branch 'main' of http://115.190.8.52:3000/sczx_group/sczx_gateway 2025-09-11 01:11:21 +08:00
47cbb100d6 从nacos拉取配置 2025-09-11 01:11:17 +08:00
6 changed files with 19 additions and 51 deletions

View File

@ -74,6 +74,11 @@
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-loadbalancer</artifactId>

View File

@ -40,7 +40,7 @@ public class CustomRouteConfig {
RouteLocatorBuilder.Builder routesBuilder = builder.routes();
// 定义需要路由的服务列表
String[] serviceNames = {"sczx-user", "sczx-store", "sczx-car", "sczx-order", "sczx-sync", "sczx-singlepay"};
String[] serviceNames = {"sczx-user", "sczx-store", "sczx-car", "sczx-order", "sczx-sync", "sczx-singlepay", "sczx-notify"};
// 为每个服务添加路由规则(如果服务存在)
for (String serviceName : serviceNames) {

View File

@ -59,7 +59,7 @@ public class DynamicRouteConfig implements RouteDefinitionLocator {
List<RouteDefinition> routeDefinitions = new ArrayList<>();
// 定义需要路由的服务列表
String[] serviceNames = {"sczx-user", "sczx-store", "sczx-car", "sczx-order", "sczx-sync", "sczx-singlepay"};
String[] serviceNames = {"sczx-user", "sczx-store", "sczx-car", "sczx-order", "sczx-sync", "sczx-singlepay", "sczx-notify"};
// 为每个服务添加路由规则(如果服务存在)
for (String serviceName : serviceNames) {

View File

@ -44,7 +44,9 @@ public class AuthGlobalFilter implements GlobalFilter, Ordered {
"/zc/sync/**",
//支付服务都放行
"/zc/singlepay/**",
"/zc/notify/**",
"/zc/order/pubOrder/**",
"/zc/order/verify/**",
// Swagger 放行

View File

@ -1,55 +1,6 @@
server:
port: 8089
shutdown: graceful # 启用优雅停机
spring:
application:
name: sczx-gateway
cloud:
# gateway:
# discovery:
# locator:
# enabled: true # 开启从注册中心动态获取路由
# lower-case-service-id: true # 服务名转小写
# routes:
# - id: sczx_user
## uri: http://172.18.0.4:8081
# uri: lb://sczx_user
# predicates:
# - Path=/zc/user/**
# filters:
# - StripPrefix=2
# - id: sczx_store
# uri: lb://sczx_store
# predicates:
# - Path=/zc/store/**
# filters:
# - StripPrefix=2
nacos:
discovery:
server-addr: 115.190.8.52:8848 # Nacos 地址
group: DEFAULT_GROUP
watch-delay: 120000 # 60秒刷新一次
loadbalancer:
ribbon:
enabled: false
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: always
auth:
secret-key: his-is-a-very-long-and-secure-secret-key-for-jwt-signing-please-dont-use-short-keys
token-expiration: 86400000 # 24小时
#logging:
# level:
# org.springframework.cloud.gateway: DEBUG
# org.springframework.cloud.loadbalancer: DEBUG
# reactor.core.publisher: DEBUG

View File

@ -0,0 +1,10 @@
spring:
application:
name: sczx-gateway # 应用名称,对应 Nacos 配置的 dataId
cloud:
nacos:
server-addr: 115.190.8.52:8848 # Nacos 服务器地址
config:
group: DEFAULT_GROUP # 配置分组
file-extension: yaml # 配置文件格式
timeout: 5000 # 配置读取超时时间