From 714eca49223a7eabdfc6666eb745c631d27046dc Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期三, 11 六月 2025 19:37:04 +0800
Subject: [PATCH] pref:锁日志

---
 LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs  |    1 +
 LifePayment/LifePayment.Worker/Worker/CheckUnPayOrderWork.cs      |    4 ++++
 LifePayment/LifePayment.Application/LifePay/LifePayService.cs     |    2 ++
 LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs |    2 ++
 4 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
index 2345215..637ff94 100644
--- a/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
+++ b/LifePayment/LifePayment.Application/LifePay/LifePayService.cs
@@ -23,6 +23,7 @@
 using Volo.Abp.EventBus.Distributed;
 using Z.EntityFramework.Plus;
 using ZeroD.Util;
+using ZeroD.Util.Fadd;
 using static LifePayment.Domain.Shared.LifePaymentConstant;
 
 namespace LifePayment.Application;
@@ -1536,6 +1537,7 @@
         CheckExtensions.IfTrueThrowUserFriendlyException(order == null, "璁㈠崟涓嶅瓨鍦�");
 
         await using var orderLock = await distributedLock.TryAcquireAsync($"LockKey:UpdateOrder:{orderNo}", TimeSpan.FromSeconds(60));
+        _logger.LogInformation($"閿侊細LockKey:UpdateOrder:{orderNo} - {orderLock != null}");
 
         if (order.ACOOLYStatus.HasValue && (int)order.ACOOLYStatus > (int)acoolyStatus)
         {
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs b/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
index 3ecc609..be0fd5a 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs
@@ -66,6 +66,7 @@
                 if (input.TradeStatus == LifePaymentConstant.AliPayStatus.鏀粯鎴愬姛 && input.OutBizNo.IsNullOrEmpty())
                 {
                     await using var orderLock = await distributedLock.TryAcquireAsync($"LockKey:UpdateOrder:{input.OutTradeNo}", TimeSpan.FromSeconds(60));
+                    _logger.LogInformation($"閿侊細LockKey:UpdateOrder:{input.OutTradeNo} - {orderLock != null}");
 
                     await _lifePayService.LifePaySuccessHandler(input.OutTradeNo, input.TradeNo);
                     // 鎻掑叆鏀舵敮娴佹按
@@ -82,6 +83,7 @@
                     && (input.RefundFee.HasValue && input.RefundFee > 0)))
                 {
                     await using var orderLock = await distributedLock.TryAcquireAsync($"LockKey:UpdateOrder:{input.OutTradeNo}", TimeSpan.FromSeconds(60));
+                    _logger.LogInformation($"閿侊細LockKey:UpdateOrder:{input.OutTradeNo} - {orderLock != null}");
 
                     await _lifePayService.LifePayRefundsHandler(input.OutTradeNo, LifePayRefundStatusEnum.宸查��娆�);
                     // 鎻掑叆鏀舵敮娴佹按
diff --git a/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs b/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
index 3ff1a0d..74ddb7b 100644
--- a/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
+++ b/LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs
@@ -69,6 +69,7 @@
                     if (wxPayNotice.TradeState == LifePaymentConstant.WxPayStatus.鏀粯鎴愬姛)
                     {
                         await using var orderLock = await distributedLock.TryAcquireAsync($"LockKey:UpdateOrder:{wxPayNotice.OutTradeNo}", TimeSpan.FromSeconds(60));
+                        _logger.LogInformation($"閿侊細LockKey:UpdateOrder:{wxPayNotice.OutTradeNo} - {orderLock != null}");
 
                         var key = $"WxRechargeNotify_{wxPayNotice.OutTradeNo}";
                         if (string.IsNullOrWhiteSpace(distributedCache.Get(key)))
diff --git a/LifePayment/LifePayment.Worker/Worker/CheckUnPayOrderWork.cs b/LifePayment/LifePayment.Worker/Worker/CheckUnPayOrderWork.cs
index 5bd2dec..0de3470 100644
--- a/LifePayment/LifePayment.Worker/Worker/CheckUnPayOrderWork.cs
+++ b/LifePayment/LifePayment.Worker/Worker/CheckUnPayOrderWork.cs
@@ -26,6 +26,7 @@
     {
         private readonly int _doWorkHour = 0;
         private readonly int _doWorkMinute = 1;
+        private readonly ILogger<CheckUnPayOrderWork> logger;
         private readonly ILifePayOrderService lifePayOrderService;
         private readonly ILifePayService lifePayService;
         private readonly IAbpDistributedLock distributedLock;
@@ -33,6 +34,7 @@
 
         public CheckUnPayOrderWork(
             AbpAsyncTimer timer,
+            ILogger<CheckUnPayOrderWork> logger,
             IServiceScopeFactory serviceScopeFactory,
             ILifePayOrderService lifePayOrderService,
             ILifePayService lifePayService,
@@ -40,6 +42,7 @@
             IRepository<LifePayOrder, Guid> lifePayOrderRepository) : base(timer, serviceScopeFactory)
         {
             timer.Period = (int)TimeSpan.FromSeconds(5).TotalMilliseconds;
+            this.logger = logger;
             this.lifePayOrderService = lifePayOrderService;
             this.lifePayService = lifePayService;
             this.distributedLock = distributedLock;
@@ -58,6 +61,7 @@
                 foreach (var order in orders)
                 {
                     await using var orderLock = await distributedLock.TryAcquireAsync($"LockKey:UpdateOrder:{order.OrderNo}", TimeSpan.FromSeconds(60));
+                    logger.LogInformation($"閿侊細LockKey:UpdateOrder:{order.OrderNo} - {orderLock != null}");
 
                     Logger.LogInformation($"璁㈠崟锛歿order.OrderNo}-{order.ToJson()}");
                     var wxPayNotice = await lifePayService.WxPayTradeQuery(order.OrderNo);

--
Gitblit v1.9.1