fix(shop): 修复支付回调状态判断逻辑,确保订单状态更新

- 将支付成功状态判断由字符串比较改为枚举值比较
- 使用 Transaction.TradeStateEnum.SUCCESS 替代 "支付成功" 字符串判断
- 避免因状态描述字符串不一致导致支付回调处理失败
- 保证支付成功后订单状态能够正确更新
This commit is contained in:
2026-04-13 02:14:34 +08:00
parent 701a135edd
commit 9297d13045
3 changed files with 18 additions and 2 deletions

View File

@@ -35,5 +35,5 @@
}
]
},
"lastUpdated": 1776002597201
"lastUpdated": 1776017110068
}

View File

@@ -0,0 +1,15 @@
# 2026-04-13 工作日志
## 修复支付回调订单状态不更新问题
**问题描述**:支付成功后,订单支付状态没有更新,回调地址 `https://glt-api.websoft.top/api/shop/shop-order/notify` 接收到了通知但订单状态未改变。
**问题原因**`ShopOrderController.java``wxNotify` 方法中,使用 `StrUtil.equals("支付成功", transaction.getTradeStateDesc())` 来判断支付状态。但微信返回的 `tradeStateDesc` 可能不是固定的 "支付成功" 字符串(可能是 "SUCCESS" 或其他描述),导致支付成功的回调没有被正确处理。
**修复方案**:将状态判断从字符串比较改为枚举值比较:
- 原代码:`if (StrUtil.equals("支付成功", transaction.getTradeStateDesc()))`
- 修复后:`if (Transaction.TradeStateEnum.SUCCESS.equals(transaction.getTradeState()))`
**修改文件**`src/main/java/com/gxwebsoft/shop/controller/ShopOrderController.java`
**状态**:已修复