bug:产品下架仍可以购买

This commit is contained in:
qiyunfanbo126.com 2024-07-16 14:13:30 +08:00
parent d9127c550b
commit b24a0b5525
2 changed files with 3 additions and 2 deletions

View File

@ -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 {

View File

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