| | |
| | | Logger.LogInformation($"检查未支付订单状态开始: {DateTime.Now}"); |
| | | var end = DateTime.Now; |
| | | var start = end.AddMinutes(-15); |
| | | var orderNos = lifePayOrderRepository.Where(it => it.PayStatus == LifePayStatusEnum.未支付 && it.CreationTime >= start && it.CreationTime <= end).Select(it => it.OrderNo).ToList(); |
| | | foreach (var orderNo in orderNos) |
| | | var orders = lifePayOrderRepository.Where(it => it.PayStatus == LifePayStatusEnum.未支付 && it.CreationTime >= start && it.CreationTime <= end).ToList(); |
| | | foreach (var order in orders) |
| | | { |
| | | var wxPayNotice = await lifePayService.WxPayTradeQuery(orderNo); |
| | | var json = wxPayNotice.ToJson(); |
| | | Logger.LogInformation($"订单({wxPayNotice.OutTradeNo})信息: {json}"); |
| | | if (wxPayNotice.OutTradeNo.Contains("JF") && wxPayNotice.TradeState == LifePaymentConstant.WxPayStatus.支付成功) |
| | | { |
| | | await lifePayService.LifePaySuccessHandler(wxPayNotice.OutTradeNo, wxPayNotice.TransactionId); |
| | | Logger.LogInformation($"订单:{order.OrderNo}-{order.ToJson()}"); |
| | | //var wxPayNotice = await lifePayService.WxPayTradeQuery(order.OrderNo); |
| | | //var json = wxPayNotice.ToJson(); |
| | | //Logger.LogInformation($"订单({wxPayNotice.OutTradeNo})信息: {json}"); |
| | | //if (wxPayNotice.OutTradeNo.Contains("JF") && wxPayNotice.TradeState == LifePaymentConstant.WxPayStatus.支付成功) |
| | | //{ |
| | | // await lifePayService.LifePaySuccessHandler(wxPayNotice.OutTradeNo, wxPayNotice.TransactionId); |
| | | |
| | | // 插入收支流水 |
| | | await lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput() |
| | | { |
| | | OrderNo = wxPayNotice.OutTradeNo, |
| | | OutOrderNo = wxPayNotice.TransactionId, |
| | | LifePayType = LifePayTypeEnum.WxPay, |
| | | ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses, |
| | | Amount = wxPayNotice.Amount.Total |
| | | }); |
| | | // // 插入收支流水 |
| | | // await lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput() |
| | | // { |
| | | // OrderNo = wxPayNotice.OutTradeNo, |
| | | // OutOrderNo = wxPayNotice.TransactionId, |
| | | // LifePayType = LifePayTypeEnum.WxPay, |
| | | // ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses, |
| | | // Amount = wxPayNotice.Amount.Total |
| | | // }); |
| | | |
| | | Logger.LogInformation("已改为支付成功"); |
| | | } |
| | | else |
| | | { |
| | | Logger.LogInformation("未更新"); |
| | | } |
| | | // Logger.LogInformation("已改为支付成功"); |
| | | //} |
| | | //else |
| | | //{ |
| | | // Logger.LogInformation("未更新"); |
| | | //} |
| | | } |
| | | } |
| | | catch (Exception ex) |