From 7a540f529d2c9a541993bc9818cad9c9093fec91 Mon Sep 17 00:00:00 2001
From: zhengyiming <540361168@qq.com>
Date: 星期三, 03 十二月 2025 11:04:35 +0800
Subject: [PATCH] fix: bug
---
LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs | 59 +++++++++++++++++++++++++++++++++++------------------------
1 files changed, 35 insertions(+), 24 deletions(-)
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs b/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
index 9450126..97c023c 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
@@ -49,6 +49,7 @@
/// </summary>
/// <returns></returns>
[HttpPost]
+ [UnitOfWork(false)]
public async Task<ContentResult> AliRechargeNotify()
{
_logger.LogError($"鐢熸椿绠″鏀粯瀹濆厖鍊煎洖璋冮�氱煡锛氳繘鍏ユ敮浠樺疂鍥炶皟");
@@ -65,34 +66,44 @@
if (input.OutTradeNo.Contains("JF"))
{
- if (input.TradeStatus == LifePaymentConstant.AliPayStatus.鏀粯鎴愬姛 && input.OutBizNo.IsNullOrEmpty())
+ try
{
- await _lifePayService.LifePaySuccessHandler(input.OutTradeNo, input.TradeNo);
- // 鎻掑叆鏀舵敮娴佹按
- await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
+ if (input.TradeStatus == LifePaymentConstant.AliPayStatus.鏀粯鎴愬姛 && input.OutBizNo.IsNullOrEmpty())
{
- OrderNo = input.OutTradeNo,
- OutOrderNo = input.TradeNo,
- LifePayType = LifePayTypeEnum.AliPay,
- ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses
- });
- await CurrentUnitOfWork.SaveChangesAsync();
+ await _lifePayService.LifePaySuccessHandler(input.OutTradeNo, input.TradeNo);
+ // 鎻掑叆鏀舵敮娴佹按
+ await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
+ {
+ OrderNo = input.OutTradeNo,
+ OutOrderNo = input.TradeNo,
+ LifePayType = LifePayTypeEnum.AliPay,
+ ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Expenses
+ });
+ await CurrentUnitOfWork.SaveChangesAsync();
+ _logger.LogInformation("浜嬪姟瀹屾垚");
+ }
+ else if (((input.TradeStatus == LifePaymentConstant.AliPayStatus.鏀粯鎴愬姛 || input.TradeStatus == LifePaymentConstant.AliPayStatus.瓒呮椂鍏抽棴)
+ && input.OutBizNo.IsNotNullOrEmpty()
+ && (input.RefundFee.HasValue && input.RefundFee > 0)))
+ {
+ await _lifePayService.LifePayRefundsHandler(input.OutTradeNo, LifePayRefundStatusEnum.宸查��娆�);
+ // 鎻掑叆鏀舵敮娴佹按
+ await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
+ {
+ OrderNo = input.OutTradeNo,
+ OutRefundNo = input.OutBizNo,
+ OutOrderNo = input.TradeNo,
+ LifePayType = LifePayTypeEnum.AliPay,
+ ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Receipts
+ });
+ await CurrentUnitOfWork.SaveChangesAsync();
+ _logger.LogInformation("浜嬪姟瀹屾垚");
+ }
}
- else if (((input.TradeStatus == LifePaymentConstant.AliPayStatus.鏀粯鎴愬姛 || input.TradeStatus == LifePaymentConstant.AliPayStatus.瓒呮椂鍏抽棴)
- && input.OutBizNo.IsNotNullOrEmpty()
- && (input.RefundFee.HasValue && input.RefundFee > 0)))
+ catch (Exception ex)
{
- await _lifePayService.LifePayRefundsHandler(input.OutTradeNo, LifePayRefundStatusEnum.宸查��娆�);
- // 鎻掑叆鏀舵敮娴佹按
- await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput()
- {
- OrderNo = input.OutTradeNo,
- OutRefundNo = input.OutBizNo,
- OutOrderNo = input.TradeNo,
- LifePayType = LifePayTypeEnum.AliPay,
- ExpensesReceiptsType = ExpensesReceiptsTypeEnum.Receipts
- });
- await CurrentUnitOfWork.SaveChangesAsync();
+ await CurrentUnitOfWork.RollbackAsync();
+ _logger.LogError($"鏀粯瀹濇敮浠樺洖璋冨紓甯革細{ex.Message}", ex);
}
}
else
--
Gitblit v1.9.1