duxin 3 ay önce
ebeveyn
işleme
95f601efc1
1 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  1. 2 2
      internal/controller/returnOnlineHandler.go

+ 2 - 2
internal/controller/returnOnlineHandler.go

@@ -29,7 +29,7 @@ func GetReturnOnlineHandler(r *ghttp.Request) {
 			money     = gconv.Int(param.Money)
 			payWay    = param.PayWay
 		)
-		orderRes, err := g.DB().GetOne(r.Context(), "SELECT buy_subject,user_phone,company_name,product_type,pay_money FROM dataexport_order WHERE order_code=?", orderCode)
+		orderRes, err := g.DB().GetOne(r.Context(), "SELECT buy_subject,user_phone,company_name,product_type,pay_money+(select IFNULL(sum(payMoney),0) as return_money from moneyCorrection where orderCode=?) as pay_money FROM dataexport_order WHERE order_code=?", orderCode, orderCode)
 		if err != nil {
 			return nil, gerror.Wrapf(err, "查询订单数据异常%s", orderCode)
 		}
@@ -45,7 +45,7 @@ func GetReturnOnlineHandler(r *ghttp.Request) {
 
 		switch doType {
 		case "query":
-			if payMoney-returnedMoney <= 0 {
+			if gconv.Int(orderRes.Map()["pay_money"])-returnedMoney <= 0 {
 				return nil, fmt.Errorf("待支付金额异常")
 			}
 			account, product := formatShow(orderMap)