mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-09 04:49:02 +08:00
feat(pay): 更新微信支付回调URL和重定向URI以支持微服务架构
- 修改WeChatMpPayOrderHandler中notify_url路径逻辑适配微服务环境 - 调整PayGoodsOrderController中redirect_uri构造方式支持微服务路由 - 使用WebUtils.isMicro()动态判断当前运行环境 - 统一支付模块在微服务和单体架构下的URL路径格式
This commit is contained in:
1 parent
02e60b3968
commit
8c924da2dc
2 files changed
+6
-3
No files matched your search
+4
-2
@@ -28,6 +28,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.core.util.WebUtils;
|
||||
import com.pig4cloud.pigx.common.data.tenant.TenantContextHolder;
|
||||
import com.pig4cloud.pigx.common.excel.annotation.ResponseExcel;
|
||||
import com.pig4cloud.pigx.common.log.annotation.SysLog;
|
||||
@@ -107,8 +108,9 @@ public class PayGoodsOrderController {
|
||||
String wxUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s"
|
||||
+ "&redirect_uri=%s&response_type=code&scope=snsapi_base&state=%s";
|
||||
|
||||
String redirectUri = String.format("%s/admin/goods/wx?amount=%s&TENANT-ID=%s", channel.getNotifyUrl(),
|
||||
goods.getAmount(), TenantContextHolder.getTenantId());
|
||||
String redirectUri = String.format("%s/api/%s/goods/wx?amount=%s&TENANT-ID=%s",
|
||||
WebUtils.isMicro() ? "pay" : "admin", channel.getNotifyUrl(), goods.getAmount(),
|
||||
TenantContextHolder.getTenantId());
|
||||
|
||||
response.sendRedirect(
|
||||
String.format(wxUrl, channel.getAppId(), URLUtil.encode(redirectUri), channel.getAppId()));
|
||||
|
||||
+2
-1
@@ -129,7 +129,8 @@ public class WeChatMpPayOrderHandler extends AbstractPayOrderHandler {
|
||||
.out_trade_no(String.valueOf(tradeOrder.getOrderId()))
|
||||
.total_fee(goodsOrder.getAmount())
|
||||
.spbill_create_ip(ip)
|
||||
.notify_url(String.format("%s/api/%s/notify/wx/callbak", ChannelPayApiConfigKit.get().getNotifyUrl(), WebUtils.isMicro() ? "pay" : "admin"))
|
||||
.notify_url(String.format("%s/api/%s/notify/wx/callbak", ChannelPayApiConfigKit.get().getNotifyUrl(),
|
||||
WebUtils.isMicro() ? "pay" : "admin"))
|
||||
.trade_type(TradeType.JSAPI.getTradeType())
|
||||
.openid(goodsOrder.getUserId())
|
||||
.build()
|
||||
|
||||
Reference in new issue
Block a user