fix refurn
This commit is contained in:
parent
f8155eb92f
commit
e981a1e069
@ -189,19 +189,39 @@ func (l *WechatPayRefundCallbackLogic) WechatPayRefundCallback(w http.ResponseWr
|
||||
l.sendSuccessResponse(w)
|
||||
return nil
|
||||
}
|
||||
if notification.Status == nil {
|
||||
logx.Errorf("【退款回调】Status字段为空")
|
||||
|
||||
orderNo := *notification.OutTradeNo
|
||||
logx.Infof("【退款回调】提取到订单号: %s", orderNo)
|
||||
|
||||
// 3. 判断退款状态,优先使用Status,如果Status为nil则使用SuccessTime判断
|
||||
var status refunddomestic.Status
|
||||
var statusDetermined bool = false
|
||||
|
||||
if notification.Status != nil {
|
||||
status = *notification.Status
|
||||
statusDetermined = true
|
||||
logx.Infof("【退款回调】从Status字段获取状态: %v", status)
|
||||
} else if notification.SuccessTime != nil && !notification.SuccessTime.IsZero() {
|
||||
// 如果Status为空但SuccessTime有值,说明退款成功
|
||||
status = refunddomestic.STATUS_SUCCESS
|
||||
statusDetermined = true
|
||||
logx.Infof("【退款回调】Status为空,但SuccessTime有值(%v),判断为退款成功", notification.SuccessTime)
|
||||
} else {
|
||||
logx.Errorf("【退款回调】Status和SuccessTime都为空,无法确定退款状态")
|
||||
l.sendSuccessResponse(w)
|
||||
return nil
|
||||
}
|
||||
|
||||
orderNo := *notification.OutTradeNo
|
||||
status := *notification.Status
|
||||
logx.Infof("【退款回调】提取到订单号: %s, 状态: %v", orderNo, status)
|
||||
if !statusDetermined {
|
||||
logx.Errorf("【退款回调】无法确定退款状态")
|
||||
l.sendSuccessResponse(w)
|
||||
return nil
|
||||
}
|
||||
|
||||
logx.Infof("【退款回调】最终确定状态: %v", status)
|
||||
var processErr error
|
||||
|
||||
// 3. 根据订单号前缀处理不同类型的订单
|
||||
// 4. 根据订单号前缀处理不同类型的订单
|
||||
logx.Infof("【退款回调】开始根据订单号前缀分发处理")
|
||||
switch {
|
||||
case strings.HasPrefix(orderNo, "Q_"):
|
||||
@ -216,7 +236,7 @@ func (l *WechatPayRefundCallbackLogic) WechatPayRefundCallback(w http.ResponseWr
|
||||
processErr = l.handleQueryOrderRefund(orderNo, status)
|
||||
}
|
||||
|
||||
// 4. 处理错误并响应
|
||||
// 5. 处理错误并响应
|
||||
if processErr != nil {
|
||||
logx.Errorf("【退款回调】处理退款订单失败: orderNo=%s, err=%v", orderNo, processErr)
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user