增加品牌

This commit is contained in:
qiyunfanbo126.com 2024-10-22 18:05:36 +08:00
parent 6e9ddac90e
commit 6c0b3a6315
1 changed files with 4 additions and 9 deletions

View File

@ -166,23 +166,21 @@ func OrderRefundService(userId int, orderId int) (code int) {
if err != nil || !has { if err != nil || !has {
return errorcode.NotFound return errorcode.NotFound
} }
if order.State == common.ORDER_STATUS_ReFUNDEND {
return errorcode.OrderNOTAuthREFUND
}
if order.State != common.ORDER_STATUS_FAIL { if order.State != common.ORDER_STATUS_FAIL {
return errorcode.OrderNOTAuthREFUND return errorcode.OrderNOTAuthREFUND
} }
code, response := YouChuOrderRefund(order.Orders) code, response := YouChuOrderRefund(order.Orders)
utils.Log(nil, "code", code, response)
if code != errorcode.Success { if code != errorcode.Success {
return code return code
} else { } else {
if response.RefundOrderSta == "03" || response.RespCode == "719035" { if response.RefundOrderSta != "03" {
return errorcode.OrderRefundFail
} else {
order.State = common.ORDER_STATUS_ReFUNDEND order.State = common.ORDER_STATUS_ReFUNDEND
order.RefundOrderNo = response.RefundOrderNo order.RefundOrderNo = response.RefundOrderNo
order.RefundOrderSta = response.RefundOrderSta order.RefundOrderSta = response.RefundOrderSta
order.RefundTime = time.Now() 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 { if err == nil {
_, err = ordersmodel.GetInstance().GetDb().Exec("update products set stock=stock+1 where id = " + strconv.Itoa(order.ProductId)) _, 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 { } else {
return errorcode.OrderRefundUpdateFail return errorcode.OrderRefundUpdateFail
} }
} else {
return errorcode.OrderRefundFail
} }
} }
} }