sunpengfei
2025-06-11 714eca49223a7eabdfc6666eb745c631d27046dc
pref:锁日志
4个文件已修改
9 ■■■■■ 已修改文件
LifePayment/LifePayment.Application/LifePay/LifePayService.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.HttpApi/LifePay/AliPayNotifyController.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.HttpApi/LifePay/WxPayNotifyController.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
LifePayment/LifePayment.Worker/Worker/CheckUnPayOrderWork.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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)
        {
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.已退款);
                    // 插入收支流水
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)))
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);