diff --git a/business/jxstore/financial/financial.go b/business/jxstore/financial/financial.go index 844f29de1..d7db031d4 100644 --- a/business/jxstore/financial/financial.go +++ b/business/jxstore/financial/financial.go @@ -181,43 +181,43 @@ func (p *PayHandler) CreateRefund() (err error) { case model.PayTypeWX: //企业付款(提现) if p.VendorPayType == model.VendorPayTypeCompanyPay { - // param := &wxpayapi.TransfersParam{ - // PartnerTradeNo: p.Order.OrderID, - // CheckName: wxpayapi.CheckName, - // Desc: "冲天猴儿app提现到账", - // SpbillCreateIP: p.Ctx.GetRealRemoteIP(), - // } - // //1元以下免费,以上收取对应城市手续费 - // place, err := dao.GetPlaceByCode(dao.GetDB(), p.Order.CityCode) - // if err != nil || place == nil { - // return fmt.Errorf("未找到该城市!code:%v", p.Order.CityCode) - // } - // if p.Order.PayPrice < 100 { - // param.Amount = p.Order.PayPrice - // } else { - // param.Amount = p.Order.PayPrice * place.DividePercentage / 100 //手续费 - // } - // if authInfo, err := p.Ctx.GetV2AuthInfo(); err == nil { - // param.OpenID = authInfo.GetAuthID() - // } - // globals.SugarLogger.Debugf("CreateRefund wx param: %v", utils.Format4Output(param, false)) - // result, err2 := payMap[p.Order.Way].Transfers(param) - // if err2 == nil { - // p.Order.PayFinishedAt = utils.Str2Time(result.PaymentTime) - // p.Order.Comment = result.DeviceInfo - // p.Order.OriginalData = utils.Format4Output(result, true) - // if result.ReturnMsg == "" { - // p.Order.Status = model.OrderStatusFinished - // } else { - // p.Order.Status = model.OrderStatusCanceled - // } - // dao.UpdateEntity(dao.GetDB(), p.Order) - // if result.ReturnMsg == "" { - // err = OnCashFinished(p.Order) - // } - // } else { - // return err2 - // } + param := &wxpayapi.TransfersParam{ + PartnerTradeNo: p.Order.OrderID, + CheckName: wxpayapi.CheckName, + Desc: "冲天猴儿app提现到账", + SpbillCreateIP: p.Ctx.GetRealRemoteIP(), + } + //1元以下免费,以上收取对应城市手续费 + place, err := dao.GetPlaceByCode(dao.GetDB(), p.Order.CityCode) + if err != nil || place == nil { + return fmt.Errorf("未找到该城市!code:%v", p.Order.CityCode) + } + if p.Order.PayPrice < 100 { + param.Amount = p.Order.PayPrice + } else { + param.Amount = p.Order.PayPrice * place.DividePercentage / 100 //手续费 + } + if authInfo, err := p.Ctx.GetV2AuthInfo(); err == nil { + param.OpenID = authInfo.GetAuthID() + } + globals.SugarLogger.Debugf("CreateRefund wx param: %v", utils.Format4Output(param, false)) + result, err2 := payMap[p.Order.Way].Transfers(param) + if err2 == nil { + p.Order.PayFinishedAt = utils.Str2Time(result.PaymentTime) + p.Order.Comment = result.DeviceInfo + p.Order.OriginalData = utils.Format4Output(result, true) + if result.ReturnMsg == "" { + p.Order.Status = model.OrderStatusFinished + } else { + p.Order.Status = model.OrderStatusCanceled + } + dao.UpdateEntity(dao.GetDB(), p.Order) + if result.ReturnMsg == "" { + err = OnCashFinished(p.Order) + } + } else { + return err2 + } err = OnCashFinished(p.Order) } else if p.VendorPayType == model.VendorPayTypeTransferAccount { p.Order.PayFinishedAt = time.Now()