| | |
| | | using Castle.Core.Internal; |
| | | using LifePayment.Application.Contracts; |
| | | using LifePayment.Domain.Shared; |
| | | using Medallion.Threading; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Microsoft.Extensions.Logging; |
| | |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading.Tasks; |
| | | using Volo.Abp.AspNetCore.Mvc; |
| | | using Volo.Abp.DistributedLocking; |
| | | using Volo.Abp.Uow; |
| | | using ZeroD.Util; |
| | | |
| | |
| | | private readonly ILifePayOrderService _lifePayOrderService; |
| | | |
| | | private readonly ILogger<AliPayNotifyController> _logger; |
| | | private readonly IAbpDistributedLock distributedLock; |
| | | |
| | | public AliPayNotifyController( |
| | | |
| | | ILogger<AliPayNotifyController> logger, |
| | | |
| | | IAbpDistributedLock distributedLock, |
| | | ILifePayService lifePayService, |
| | | ILifePayOrderService lifePayOrderService) |
| | | { |
| | | _logger = logger; |
| | | this.distributedLock = distributedLock; |
| | | _lifePayService = lifePayService; |
| | | _lifePayOrderService = lifePayOrderService; |
| | | } |
| | |
| | | { |
| | | 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); |
| | | // 插入收支流水 |
| | | await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput() |
| | |
| | | && input.OutBizNo.IsNotNullOrEmpty() |
| | | && (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.已退款); |
| | | // 插入收支流水 |
| | | await _lifePayOrderService.AddLifePayExpensesReceipts(new AddLifePayExpensesReceiptsInput() |