lijin
2025-11-20 1d03ddefc1b5458eede592d5b5780c3c2b10dfca
ApiTools.Application/ChannelWallets/Commands/ChannelWalletCommandHandler.cs
@@ -29,6 +29,12 @@
        private readonly ChannelWalletTransactionRepository channelWalletTransactionRepository = channelWalletTransactionRepository;
        private readonly ChannelWalletService channelWalletService = channelWalletService;
        /// <summary>
        /// 保存渠道平安银行钱包
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<SaveChannelPingAnPayWalletCommandResult> Handle(SaveChannelPingAnPayWalletCommand request, CancellationToken cancellationToken)
        {
            var logier = JwtUtils.GetCurrentLogier();
@@ -40,23 +46,23 @@
                wallet = new ChannelWallet();
                wallet.ChannelId = logier.ChannelId;
                wallet.Access = EnumWalletAccess.PingAnPay;
                wallet.SignStatus = EnumWalletSignStatus.Normal;
                wallet.Bank = "平安银行";
                wallet.SignStatus = EnumWalletSignStatus.Apply;
                request.Adapt(wallet);
                await channelWalletRepository.SetCode(wallet);
                await channelWalletRepository.InsertNowAsync(wallet);
            }
            else
            {
                wallet.SignStatus = EnumWalletSignStatus.Apply;
                request.Adapt(wallet);
                await channelWalletRepository.UpdateNowAsync(wallet);
            }
            await channelWalletService.GetEnterpriseWalletBalance(wallet);
            return new SaveChannelPingAnPayWalletCommandResult
            {
                WalletId = wallet.Id,
                Id = wallet.Id,
                Balance = wallet.Balance,
                ErrorCode = wallet.ErrorCode,
                FailReason = wallet.FailReason
            };
        }
@@ -80,7 +86,7 @@
                .FirstOrDefaultAsync();
            if (wallet == null) throw Oops.Oh(EnumErrorCodeType.s404, "未开通钱包");
            if (wallet.SignStatus != EnumWalletSignStatus.Normal) throw Oops.Oh(EnumErrorCodeType.s404, "钱包未签约");
            await channelWalletService.GetEnterpriseWalletBalance(wallet);
            if (request.Amount > wallet.Balance) throw Oops.Oh(EnumErrorCodeType.s404, "余额不足");