| | |
| | | using LifePayment.Application.Contracts; |
| | | using LifePayment.Domain; |
| | | using LifePayment.Domain.Shared; |
| | | using Medallion.Threading; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.Extensions.Caching.Distributed; |
| | | using Microsoft.Extensions.Logging; |
| | |
| | | using System.Threading.Tasks; |
| | | using Volo.Abp.AspNetCore.Mvc; |
| | | using Volo.Abp.Caching; |
| | | using Volo.Abp.DistributedLocking; |
| | | using Volo.Abp.Uow; |
| | | using ZeroD.Util; |
| | | |
| | |
| | | private readonly ILifePayService _lifePayService; |
| | | private readonly ILifePayOrderService _lifePayOrderService; |
| | | private readonly IDistributedCache<string> distributedCache; |
| | | private readonly IAbpDistributedLock distributedLock; |
| | | private readonly ILogger<WxPayNotifyController> _logger; |
| | | |
| | | public WxPayNotifyController( |
| | |
| | | ILogger<WxPayNotifyController> logger, |
| | | ILifePayService lifePayService, |
| | | ILifePayOrderService lifePayOrderService, |
| | | IDistributedCache<string> distributedCache) |
| | | IDistributedCache<string> distributedCache, |
| | | IAbpDistributedLock distributedLock) |
| | | { |
| | | _wxPayApi = wxPayApi; |
| | | _logger = logger; |
| | | _lifePayService = lifePayService; |
| | | _lifePayOrderService = lifePayOrderService; |
| | | this.distributedCache = distributedCache; |
| | | this.distributedLock = distributedLock; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | { |
| | | 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))) |
| | | { |