订单详情增加notifyurl
This commit is contained in:
parent
235f8f70d3
commit
ac222c0880
|
@ -216,6 +216,7 @@ func OrderNotify(request front.YouChuRequest) (NotifyResponse front.YouChuOrderN
|
||||||
session := ordersmodel.GetInstance().GetDb().NewSession()
|
session := ordersmodel.GetInstance().GetDb().NewSession()
|
||||||
defer func() {
|
defer func() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
utils.Log(nil, "notify err", err)
|
||||||
_ = session.Rollback()
|
_ = session.Rollback()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -225,12 +226,14 @@ func OrderNotify(request front.YouChuRequest) (NotifyResponse front.YouChuOrderN
|
||||||
if YouChuOrderNotifyRequest.TxnFlag == "01" {
|
if YouChuOrderNotifyRequest.TxnFlag == "01" {
|
||||||
_, err = session.Where("id = ?", orderDetail.ProductId).Where("stock >= ?", common.ORDER_STATUS_DEFAULT).Update(&productDetail)
|
_, err = session.Where("id = ?", orderDetail.ProductId).Where("stock >= ?", common.ORDER_STATUS_DEFAULT).Update(&productDetail)
|
||||||
if err = session.Begin(); err != nil {
|
if err = session.Begin(); err != nil {
|
||||||
|
utils.Log(nil, "notify err", err)
|
||||||
return front.YouChuOrderNotifyResponse{RespCode: "000004", RespMsg: "库存不足"}
|
return front.YouChuOrderNotifyResponse{RespCode: "000004", RespMsg: "库存不足"}
|
||||||
}
|
}
|
||||||
client := market.NewMarketClient(config.GetConf().OpenApiMarketConfig)
|
client := market.NewMarketClient(config.GetConf().OpenApiMarketConfig)
|
||||||
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 {
|
||||||
|
utils.Log(nil, "notify err", err)
|
||||||
return front.YouChuOrderNotifyResponse{RespCode: "000004", RespMsg: "充值失败"}
|
return front.YouChuOrderNotifyResponse{RespCode: "000004", RespMsg: "充值失败"}
|
||||||
}
|
}
|
||||||
order.OrgTxnSeq = YouChuOrderNotifyRequest.OrderNo
|
order.OrgTxnSeq = YouChuOrderNotifyRequest.OrderNo
|
||||||
|
@ -239,6 +242,7 @@ func OrderNotify(request front.YouChuRequest) (NotifyResponse front.YouChuOrderN
|
||||||
} else {
|
} else {
|
||||||
order.State = common.ORDER_STATUS_FINISH
|
order.State = common.ORDER_STATUS_FINISH
|
||||||
order.VoucherLink = send.Data.ShortUrl
|
order.VoucherLink = send.Data.ShortUrl
|
||||||
|
utils.Log(nil, "nitifydata", send.Data.ShortUrl, "***", send.Data.VoucherId)
|
||||||
//Stock, _ := strconv.Atoi(productDetail.Stock)
|
//Stock, _ := strconv.Atoi(productDetail.Stock)
|
||||||
//productDetail.Stock = strconv.Itoa(Stock - 1)
|
//productDetail.Stock = strconv.Itoa(Stock - 1)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue