From 67fc39c356d8b480b7005cb2fa4769a0a6c6cfb1 Mon Sep 17 00:00:00 2001 From: sunpengfei <i@angelzzz.com> Date: 星期五, 13 六月 2025 14:19:56 +0800 Subject: [PATCH] pref:优化事务 --- LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs b/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs index 9e30708..e958bac 100644 --- a/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs +++ b/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs @@ -53,6 +53,7 @@ /// <param name="input"></param> /// <returns></returns> [HttpPost] + [UnitOfWork(false)] public async Task<WxRechargeNotifyResult> WxRechargeNotify(WxRechargeNotifyInput input) { try @@ -94,7 +95,8 @@ AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(10) }); - await CurrentUnitOfWork.SaveChangesAsync(); + await CurrentUnitOfWork.CompleteAsync(); + _logger.LogInformation("浜嬪姟瀹屾垚"); } else { @@ -113,6 +115,8 @@ } catch (Exception ex) { + await CurrentUnitOfWork.RollbackAsync(); + _logger.LogError($"寰俊鏀粯鍥炶皟寮傚父锛歿ex.Message}", ex); return new WxRechargeNotifyResult { Code = "FAIL", -- Gitblit v1.9.1