Files
java-10584/.workbuddy/memory/2026-04-13.md
赵忠林 9297d13045 fix(shop): 修复支付回调状态判断逻辑,确保订单状态更新
- 将支付成功状态判断由字符串比较改为枚举值比较
- 使用 Transaction.TradeStateEnum.SUCCESS 替代 "支付成功" 字符串判断
- 避免因状态描述字符串不一致导致支付回调处理失败
- 保证支付成功后订单状态能够正确更新
2026-04-13 02:14:34 +08:00

16 lines
982 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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`
**状态**:已修复