From 6c0b3a631523f29cddcb30c45155f1d9351a127c Mon Sep 17 00:00:00 2001 From: "qiyunfanbo126.com" <815699> Date: Tue, 22 Oct 2024 18:05:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=93=81=E7=89=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/OrderService.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/app/services/OrderService.go b/app/services/OrderService.go index 406179e..3b27bc0 100644 --- a/app/services/OrderService.go +++ b/app/services/OrderService.go @@ -166,23 +166,21 @@ func OrderRefundService(userId int, orderId int) (code int) { if err != nil || !has { return errorcode.NotFound } - if order.State == common.ORDER_STATUS_ReFUNDEND { - return errorcode.OrderNOTAuthREFUND - } if order.State != common.ORDER_STATUS_FAIL { return errorcode.OrderNOTAuthREFUND } code, response := YouChuOrderRefund(order.Orders) - utils.Log(nil, "code", code, response) if code != errorcode.Success { return code } else { - if response.RefundOrderSta == "03" || response.RespCode == "719035" { + if response.RefundOrderSta != "03" { + return errorcode.OrderRefundFail + } else { order.State = common.ORDER_STATUS_ReFUNDEND order.RefundOrderNo = response.RefundOrderNo order.RefundOrderSta = response.RefundOrderSta order.RefundTime = time.Now() - _, err := ordersmodel.GetInstance().GetDb().Where("id = ?", order.Id).Update(order) + _, err := ordersmodel.GetInstance().GetDb().Where("id = ?", order.Id).Update(order.Orders) //增加库存 if err == nil { _, err = ordersmodel.GetInstance().GetDb().Exec("update products set stock=stock+1 where id = " + strconv.Itoa(order.ProductId)) @@ -190,9 +188,6 @@ func OrderRefundService(userId int, orderId int) (code int) { } else { return errorcode.OrderRefundUpdateFail } - - } else { - return errorcode.OrderRefundFail } } }