From 1575bf504cb7ea4d20fce8af2b955abd42400f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Tue, 21 Apr 2026 13:04:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(payment):=20=E4=BF=AE=E5=A4=8D=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=9B=9E=E8=B0=83=E5=9C=B0=E5=9D=80=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 apiUrl 配置属性,支持通过 API 网关地址访问回调 - 优先使用 apiUrl 拼接回调地址,确保回调服务公网可访问 - 兼容原有 serverUrl 配置,作为备用回调地址使用 - 移除默认注释,明确支付回调地址的选择逻辑 --- .../core/service/EnvironmentAwarePaymentService.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gxwebsoft/common/core/service/EnvironmentAwarePaymentService.java b/src/main/java/com/gxwebsoft/common/core/service/EnvironmentAwarePaymentService.java index 2155cc9..c8bdf53 100644 --- a/src/main/java/com/gxwebsoft/common/core/service/EnvironmentAwarePaymentService.java +++ b/src/main/java/com/gxwebsoft/common/core/service/EnvironmentAwarePaymentService.java @@ -1,5 +1,6 @@ package com.gxwebsoft.common.core.service; +import cn.hutool.core.util.StrUtil; import com.gxwebsoft.common.system.entity.Payment; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -26,6 +27,9 @@ public class EnvironmentAwarePaymentService { @Value("${config.server-url:}") private String serverUrl; + @Value("${config.api-url:}") + private String apiUrl; + // 开发环境回调地址配置 @Value("${payment.dev.notify-url:http://frps-10550.s209.websoft.top/api/shop/shop-order/notify}") private String devNotifyUrl; @@ -73,8 +77,8 @@ public class EnvironmentAwarePaymentService { // 生产环境使用生产回调地址 return prodNotifyUrl; } else { - // 默认使用配置的服务器地址 - return serverUrl + "/shop/shop-order/notify"; + // 默认使用 API 网关地址(支付回调需要公网可访问的 API 地址) + return (StrUtil.isNotBlank(apiUrl) ? apiUrl : serverUrl) + "/shop/shop-order/notify"; } }