diff --git a/app/services/OrderService.go b/app/services/OrderService.go index dbc7cdc..e81582f 100644 --- a/app/services/OrderService.go +++ b/app/services/OrderService.go @@ -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) }