增加价格排序
This commit is contained in:
parent
2b5d5c4d99
commit
d7365c18a0
|
@ -222,12 +222,14 @@ func OrderNotify(request front.YouChuRequest) (NotifyResponse front.YouChuOrderN
|
|||
var productDetail productsmodel.Products
|
||||
has, err = productsmodel.GetInstance().GetDb().Where("id = ?", orderDetail.ProductId).Get(&productDetail)
|
||||
if err != nil || !has {
|
||||
_, err = ordersmodel.GetInstance().GetDb().Where("id = ?", orderDetail.Id).Update(ordersmodel.Orders{State: common.ORDER_STATUS_FAIL})
|
||||
utils.Log(nil, "notify err", err, orderDetail.ProductId)
|
||||
return front.YouChuOrderNotifyResponse{RespCode: "000003", RespMsg: "商品不存在"}
|
||||
}
|
||||
session := ordersmodel.GetInstance().GetDb().NewSession()
|
||||
defer func() {
|
||||
if err != nil {
|
||||
_, err = ordersmodel.GetInstance().GetDb().Where("id = ?", orderDetail.Id).Update(ordersmodel.Orders{State: common.ORDER_STATUS_FAIL})
|
||||
utils.Log(nil, "notify err", err)
|
||||
_ = session.Rollback()
|
||||
return
|
||||
|
@ -246,6 +248,7 @@ func OrderNotify(request front.YouChuRequest) (NotifyResponse front.YouChuOrderN
|
|||
send, err := client.MarketSend(orderDetail.OrderNo, strconv.Itoa(orderDetail.VoucherId), "", "2")
|
||||
utils.Log(nil, "OrderNotify-MarketSend", send, err)
|
||||
if err != nil {
|
||||
_, err = ordersmodel.GetInstance().GetDb().Where("id = ?", orderDetail.Id).Update(ordersmodel.Orders{State: common.ORDER_STATUS_FAIL})
|
||||
utils.Log(nil, "notify err", err)
|
||||
return front.YouChuOrderNotifyResponse{RespCode: "000004", RespMsg: "充值失败"}
|
||||
}
|
||||
|
@ -264,10 +267,12 @@ func OrderNotify(request front.YouChuRequest) (NotifyResponse front.YouChuOrderN
|
|||
} else {
|
||||
//order.RefundOrderNo = YouChuOrderNotifyRequest.OrgTxnSeq
|
||||
//order.RefundOrderSta = YouChuOrderNotifyRequest.OrderSta
|
||||
_, err = ordersmodel.GetInstance().GetDb().Where("id = ?", orderDetail.Id).Update(ordersmodel.Orders{State: common.ORDER_STATUS_FAIL})
|
||||
return front.YouChuOrderNotifyResponse{RespCode: "000005", RespMsg: "订单标识错误"}
|
||||
}
|
||||
_, err = session.Cols("stock,state,voucher_link,orgTxnSeq,exchange_time").Where("order_no = ?", YouChuOrderNotifyRequest.ReqTraceId).Update(&order)
|
||||
if err != nil {
|
||||
_, err = ordersmodel.GetInstance().GetDb().Where("id = ?", orderDetail.Id).Update(ordersmodel.Orders{State: common.ORDER_STATUS_FAIL})
|
||||
utils.Log(nil, "OrderNotify-MarketSend", err.Error())
|
||||
_ = session.Rollback()
|
||||
return front.YouChuOrderNotifyResponse{RespCode: "000004", RespMsg: "操作失败"}
|
||||
|
|
Loading…
Reference in New Issue