From b24a0b5525c70b6d9ea339658dc9a2c82105cf3f Mon Sep 17 00:00:00 2001 From: "qiyunfanbo126.com" <815699> Date: Tue, 16 Jul 2024 14:13:30 +0800 Subject: [PATCH] =?UTF-8?q?bug:=E4=BA=A7=E5=93=81=E4=B8=8B=E6=9E=B6?= =?UTF-8?q?=E4=BB=8D=E5=8F=AF=E4=BB=A5=E8=B4=AD=E4=B9=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/http/controllers/front/OrderController.go | 1 + app/services/OrderService.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/http/controllers/front/OrderController.go b/app/http/controllers/front/OrderController.go index ddafed3..0f7e599 100644 --- a/app/http/controllers/front/OrderController.go +++ b/app/http/controllers/front/OrderController.go @@ -47,6 +47,7 @@ func OrderQuery(c *gin.Context) { order := ordersmodel.Orders{} order.Id = orderId order.OrderNo = request.OrderNo + order.UserId = controllers.GetUserId(c) var OrderQueryResponse front.OrderQueryResponse has, err := services.OrderDetailService(&order) if err != nil { diff --git a/app/services/OrderService.go b/app/services/OrderService.go index 5673cec..a678749 100644 --- a/app/services/OrderService.go +++ b/app/services/OrderService.go @@ -42,7 +42,7 @@ func CreateOrderService(userId int, productId int) (code int, data front.InsertO _ = session.Close() }() var product productsmodel.Products - has, err := productsmodel.GetInstance().GetDb().Where("id = ?", productId).Get(&product) + has, err := productsmodel.GetInstance().GetDb().Where("id = ? and status = 1", productId).Get(&product) if err != nil { return errorcode.SystemError, data } @@ -237,7 +237,7 @@ func OrderNotify(request front.YouChuRequest) (NotifyResponse front.YouChuOrderN //order.RefundOrderSta = YouChuOrderNotifyRequest.OrderSta return front.YouChuOrderNotifyResponse{RespCode: "000005", RespMsg: "订单标识错误"} } - _, err = session.Where("order_no = ?", YouChuOrderNotifyRequest.ReqTraceId).Update(&order) + _, err = session.Cols("stock,state").Where("order_no = ?", YouChuOrderNotifyRequest.ReqTraceId).Update(&order) if err != nil { utils.Log(nil, "OrderNotify-MarketSend", err.Error()) _ = session.Rollback()