订单详情增加notifyurl

This commit is contained in:
qiyunfanbo126.com 2024-07-18 17:04:45 +08:00
parent 235f8f70d3
commit ac222c0880
1 changed files with 4 additions and 0 deletions

View File

@ -216,6 +216,7 @@ func OrderNotify(request front.YouChuRequest) (NotifyResponse front.YouChuOrderN
session := ordersmodel.GetInstance().GetDb().NewSession()
defer func() {
if err != nil {
utils.Log(nil, "notify err", err)
_ = session.Rollback()
return
}
@ -225,12 +226,14 @@ func OrderNotify(request front.YouChuRequest) (NotifyResponse front.YouChuOrderN
if YouChuOrderNotifyRequest.TxnFlag == "01" {
_, err = session.Where("id = ?", orderDetail.ProductId).Where("stock >= ?", common.ORDER_STATUS_DEFAULT).Update(&productDetail)
if err = session.Begin(); err != nil {
utils.Log(nil, "notify err", err)
return front.YouChuOrderNotifyResponse{RespCode: "000004", RespMsg: "库存不足"}
}
client := market.NewMarketClient(config.GetConf().OpenApiMarketConfig)
send, err := client.MarketSend(orderDetail.OrderNo, strconv.Itoa(orderDetail.VoucherId), "", "2")
utils.Log(nil, "OrderNotify-MarketSend", send, err)
if err != nil {
utils.Log(nil, "notify err", err)
return front.YouChuOrderNotifyResponse{RespCode: "000004", RespMsg: "充值失败"}
}
order.OrgTxnSeq = YouChuOrderNotifyRequest.OrderNo
@ -239,6 +242,7 @@ func OrderNotify(request front.YouChuRequest) (NotifyResponse front.YouChuOrderN
} else {
order.State = common.ORDER_STATUS_FINISH
order.VoucherLink = send.Data.ShortUrl
utils.Log(nil, "nitifydata", send.Data.ShortUrl, "***", send.Data.VoucherId)
//Stock, _ := strconv.Atoi(productDetail.Stock)
//productDetail.Stock = strconv.Itoa(Stock - 1)
}