This commit is contained in:
Mrx
2026-06-06 17:03:08 +08:00
parent a85436950e
commit 35e9191981
28 changed files with 666 additions and 286 deletions

View File

@@ -21,8 +21,14 @@ func fulfillQueryOrderPaid(ctx context.Context, svcCtx *svc.ServiceContext, orde
orderFen := lzUtils.ToWechatAmount(order.Amount)
if wechatPaidFen > 0 && wechatPaidFen != orderFen {
logx.WithContext(ctx).Errorf("[xpay] 金额不一致 order_no=%s order_fen=%d wechat_fen=%d", order.OrderNo, orderFen, wechatPaidFen)
return false, nil
if model.IsXpayOrder(order) {
order.Amount = lzUtils.RoundMoney(float64(wechatPaidFen) / 100)
orderFen = wechatPaidFen
logx.WithContext(ctx).Infof("[xpay] 同步微信实付金额 order_no=%s amount=%.2f fen=%d", order.OrderNo, order.Amount, wechatPaidFen)
} else {
logx.WithContext(ctx).Errorf("[xpay] 金额不一致 order_no=%s order_fen=%d wechat_fen=%d", order.OrderNo, orderFen, wechatPaidFen)
return false, nil
}
}
order.Status = "paid"
@@ -30,8 +36,8 @@ func fulfillQueryOrderPaid(ctx context.Context, svcCtx *svc.ServiceContext, orde
if platformOrderID != "" {
order.PlatformOrderId = sql.NullString{String: platformOrderID, Valid: true}
}
if order.PaymentScene == "" || order.PaymentScene == "app" {
order.PaymentScene = "wxmini"
if order.PaymentScene == "" || order.PaymentScene == model.PaymentSceneApp {
order.PaymentScene = model.PaymentSceneMiniProgram
}
if updateErr := svcCtx.OrderModel.UpdateWithVersion(ctx, nil, order); updateErr != nil {