feat(pay): 优化微信支付URL构建逻辑

- 重构redirectUri构建方式,调整参数顺序提高可读性
- 简化URL拼接逻辑,移除不必要的条件判断
- 保持原有功能不变的情况下改进代码结构
This commit is contained in:
冷冷 authored and pigcloud committed 2025-10-09 14:51:39 +08:00
1 parent 8c924da2dc
commit b329b5c501
1 file changed
+2 -3
@@ -108,9 +108,8 @@ 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/api/%s/goods/wx?amount=%s&TENANT-ID=%s",
WebUtils.isMicro() ? "pay" : "admin", channel.getNotifyUrl(), goods.getAmount(),
TenantContextHolder.getTenantId());
String redirectUri = String.format("%s/api/%s/goods/wx?amount=%s&TENANT-ID=%s", channel.getNotifyUrl(),
WebUtils.isMicro() ? "pay" : "admin", goods.getAmount(), TenantContextHolder.getTenantId());
response.sendRedirect(
String.format(wxUrl, channel.getAppId(), URLUtil.encode(redirectUri), channel.getAppId()));