|
|
@@ -196,7 +196,7 @@ func (self *PayController) payExchange(oId, payWay, returnUrl, source, remark st
|
|
|
order.PickWay = pick_way
|
|
|
//第一次支付已更新支付方式,第一次支付才计算支付金额
|
|
|
if len(order.PayWay) <= 0 {
|
|
|
- order.PayWay = payWay
|
|
|
+
|
|
|
//支付信息判断
|
|
|
//黑名单用户
|
|
|
curUser := user_model.GetUserById(wxUser.UserId, false)
|
|
|
@@ -305,7 +305,7 @@ func (self *PayController) payExchange(oId, payWay, returnUrl, source, remark st
|
|
|
order.CouponPrice = totalCoupon
|
|
|
order.PaiedSilver = paiedSilver
|
|
|
order.PaiedCash = paiedCash
|
|
|
-
|
|
|
+ order.PayWay = FindMaxPaymentMethod(total_weixin, totalCoupon, paiedCash)
|
|
|
switch needWx { // 1.true需要微信支付,2.false不需要微信支付
|
|
|
case false: // 提货券抵扣完毕
|
|
|
//更新订单状态
|
|
|
@@ -313,7 +313,7 @@ func (self *PayController) payExchange(oId, payWay, returnUrl, source, remark st
|
|
|
order.PaiedAt = time.Now().Unix()
|
|
|
order.PaiedTime = time.Now()
|
|
|
order.PaiedPrice = 0
|
|
|
- order.PayWay = pay_model.PAYWAY_BALANCE
|
|
|
+ //order.PayWay = pay_model.PAYWAY_BALANCE
|
|
|
order.Source = source
|
|
|
|
|
|
order.Save()
|
|
|
@@ -606,3 +606,18 @@ func FindNotEnoughPrd(storeMap map[int64]int64) (bool, string) {
|
|
|
}
|
|
|
return false, ""
|
|
|
}
|
|
|
+
|
|
|
+func FindMaxPaymentMethod(total_weixin, totalCoupon, paiedCash int64) string {
|
|
|
+ maxAmount := total_weixin
|
|
|
+ paymentMethod := pay_model.PAYWAY_WEIXINPAY
|
|
|
+
|
|
|
+ if totalCoupon > maxAmount {
|
|
|
+ maxAmount = totalCoupon
|
|
|
+ paymentMethod = pay_model.PAYWAY_BALANCE
|
|
|
+ }
|
|
|
+ if paiedCash > maxAmount {
|
|
|
+ paymentMethod = pay_model.PAYWAY_CASH
|
|
|
+ }
|
|
|
+
|
|
|
+ return paymentMethod
|
|
|
+}
|