This commit is contained in:
邹宗楠
2022-08-22 11:27:24 +08:00
parent 027ffa19ca
commit dc6db2db8e
6 changed files with 2 additions and 29 deletions

View File

@@ -68,14 +68,12 @@ func QueryExpressPrice(param *bida.GetExpressPriceReq) (map[string]*bida.GetExpr
param.ReceiveAddress = v + param.ReceiveAddress
}
}
globals.SugarLogger.Debug("检测param是否加上前缀", param.SendAddress, param.ReceiveAddress)
// 给快递默认值
result := make(map[string]*bida.GetExpressPriceRes, 0)
if param.Type == 0 {
// 渠道费每公斤加价五毛
switch param.ChannelType {
case 1: // 快递
globals.SugarLogger.Debug("进入QueryExpressPrice case1 ")
for i := 0; i < len(ExpressCompany); i++ {
param.Type = ExpressCompany[i]
fee, err := api.QBiDaAPI.GetExpressPrice(param)
@@ -267,12 +265,10 @@ func CancelWayOrder(ctx *jxcontext.Context, userId string, param *bida.CancelOrd
if err != nil {
return FailCode, err
}
globals.SugarLogger.Debug("回调获取order详情", orderWay)
userBill, err := dao.GetUserBill(db, orderWay.UserID, "")
if err != nil {
return FailCode, err
}
globals.SugarLogger.Debug("回调获取user_bill详情", userBill)
if orderWay.Status == 110 {
if orderWay.PayMethod == 1 { // 余额支付
@@ -306,15 +302,12 @@ func CancelWayOrder(ctx *jxcontext.Context, userId string, param *bida.CancelOrd
}
}
if orderWay.PayMethod == 5 { //混合支付
globals.SugarLogger.Debug("回调进入混合支付流程")
//余额增加相应金额
globals.SugarLogger.Debug("回调输出订单id", orderWay.OrderID)
mixPayInfo, err := dao.GetMixPayDetail(orderWay.OrderID)
if err != nil {
return FailCode, err
}
//userBill.AccountBalance = mixPayInfo.BalancePrice
globals.SugarLogger.Debug("回调输出userBill.AccountBalance", userBill.AccountBalance)
if err := dao.UpdateUserBill(userBill.UserID, mixPayInfo.BalancePrice); err != nil {
return 0, err
}
@@ -327,10 +320,6 @@ func CancelWayOrder(ctx *jxcontext.Context, userId string, param *bida.CancelOrd
return FailCode, err
}
globals.SugarLogger.Debug("回调进入微信退款")
globals.SugarLogger.Debug("orderWay==============", orderWay)
globals.SugarLogger.Debug("order==============", order)
globals.SugarLogger.Debug("order.OtherWayBill==============", order.OtherWayBill)
res, err := RefundOrderByTL(ctx, orderWay, order, order.OtherWayBill, int(orderWay.PayPrice*100), "申请退款")
if len(res.VendorRefundID) > 0 {
return SuccessCode, err
@@ -435,7 +424,6 @@ func CreateOrder2QBiDa(order *model.UserVendorOrder, orderId string) error {
// globals.SugarLogger.Debug("Callback Success But Order Status Update Fail ....")
// return errors.New("Callback Success But Order Status Update Fail ")
//}
globals.SugarLogger.Debug("我到qbd回调接口了")
// 创建QBIDA订单
makeOrder := &bida.MakeOrderReq{
PromiseTimeType: order.PromiseTimeType,
@@ -472,9 +460,7 @@ func CreateOrder2QBiDa(order *model.UserVendorOrder, orderId string) error {
otherId, err := createOtherOrder(makeOrder)
if err != nil {
order.ErrorMsg = err.Error()
globals.SugarLogger.Debug("err==========", err)
}
globals.SugarLogger.Debug("otherId==========", otherId)
order.OtherWayBill = otherId
order.OrderStatus = model.OrderStatusWaitPickup
order.UpdatedAt = time.Now()
@@ -486,16 +472,12 @@ func CreateOrder2QBiDa(order *model.UserVendorOrder, orderId string) error {
// RefundOrderByTL 发起取消订单
func RefundOrderByTL(ctx *jxcontext.Context, orderPay *model.Order, order *model.UserVendorOrder, refundID string, refundFee int, refundDesc string) (orderPayRefund *model.OrderPayRefund, err error) {
globals.SugarLogger.Debug("进入取消订单流程")
globals.SugarLogger.Debug("进入取消订单流程,输出退款金额", refundFee)
result, err := api.TLpayAPI.PayRefund(&tonglianpayapi.PayRefundParam{
Trxamt: refundFee / 100,
Reqsn: utils.GetUUID(),
Remark: refundDesc,
OldTrxID: orderPay.TransactionID,
})
globals.SugarLogger.Debug("result===============", result)
globals.SugarLogger.Debug("errerrerr===============", err)
if err == nil {
orderPayRefund = &model.OrderPayRefund{
RefundID: refundID,