From 7b47c91bcf89d667a5c99cfafe0d899280f7fbe3 Mon Sep 17 00:00:00 2001
From: sunpengfei <i@angelzzz.com>
Date: 星期三, 19 十一月 2025 11:22:27 +0800
Subject: [PATCH] feat:平安转账开发

---
 ApiTools.Core/Jobs/RefreshChannelWalletTransactionStatusJob.cs |   58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/ApiTools.Core/Jobs/RefreshChannelWalletTransactionStatusJob.cs b/ApiTools.Core/Jobs/RefreshChannelWalletTransactionStatusJob.cs
new file mode 100644
index 0000000..c92df86
--- /dev/null
+++ b/ApiTools.Core/Jobs/RefreshChannelWalletTransactionStatusJob.cs
@@ -0,0 +1,58 @@
+锘縰sing Furion;
+using Furion.DatabaseAccessor;
+using Furion.EventBus;
+using Furion.Schedule;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace ApiTools.Core
+{
+    /// <summary>
+    /// 鍒锋柊娓犻亾閽卞寘浜ゆ槗鐘舵��
+    /// </summary>
+    [JobDetail("RefreshChannelWalletTransactionStatusJob", Description = "鍒锋柊娓犻亾閽卞寘浜ゆ槗鐘舵��", Concurrent = false)]
+    [PeriodMinutes(5)]
+    public class RefreshChannelWalletTransactionStatusJob(
+            ChannelWalletRepository channelWalletRepository,
+            ChannelWalletTransactionRepository channelWalletTransactionRepository,
+            ChannelWalletService channelWalletService
+        ) : IJob
+    {
+        private readonly ChannelWalletRepository channelWalletRepository = channelWalletRepository;
+        private readonly ChannelWalletTransactionRepository channelWalletTransactionRepository = channelWalletTransactionRepository;
+        private readonly ChannelWalletService channelWalletService = channelWalletService;
+
+        public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
+        {
+            var env = App.GetConfig<string>("Environment");
+            if (env != "Local")
+            {
+                var transactions = await channelWalletTransactionRepository.GetQueryable(false)
+                .Where(it =>
+                    it.TransactionStatus == EnumWalletTransactionStatus.WaitPay
+                    || it.TransactionStatus == EnumWalletTransactionStatus.Dealing)
+                .ToListAsync();
+                var walletIds = transactions.DistinctSelect(it => it.WalletId);
+                var wallets = await channelWalletRepository.GetQueryable(false)
+                    .Where(it => walletIds.Contains(it.Id))
+                    .ToListAsync();
+                foreach (var transaction in transactions)
+                {
+                    var wallet = wallets.FirstOrDefault(it => it.Id == transaction.WalletId);
+                    if (wallet != null)
+                    {
+                        // 鏌ヨ浜ゆ槗璇︽儏
+                        await channelWalletService.GetTransactionDetail(wallet, transaction);
+                        // 涓嬭浇鍥炲崟
+                        await channelWalletService.DownloadEreceiptUrl(wallet, transaction);
+                    }
+                }
+            }
+        }
+    }
+}

--
Gitblit v1.9.1