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