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()