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/Repositories/EnterpriseWalletTransactionRepository.cs |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/ApiTools.Core/Repositories/EnterpriseWalletTransactionRepository.cs b/ApiTools.Core/Repositories/EnterpriseWalletTransactionRepository.cs
new file mode 100644
index 0000000..169b93e
--- /dev/null
+++ b/ApiTools.Core/Repositories/EnterpriseWalletTransactionRepository.cs
@@ -0,0 +1,41 @@
+锘縰sing Furion.DatabaseAccessor;
+using Furion.DependencyInjection;
+using Furion.DistributedIDGenerator;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ApiTools.Core
+{
+    public class ChannelWalletTransactionRepository : BaseRepository<ChannelWalletTransaction, MasterDbContextLocator>, IScoped
+    {
+        public ChannelWalletTransactionRepository(IRepository<ChannelWalletTransaction, MasterDbContextLocator> rep) : base(rep)
+        {
+        }
+
+        public Task<bool> CheckExist(string code, Guid? id)
+        {
+            return GetQueryableIgnoreFilter()
+                    .AnyAsync(it => it.Code == code && it.Id != id);
+        }
+
+        /// <summary>
+        /// 璁剧疆缂栧彿
+        /// </summary>
+        /// <param name="entity"></param>
+        /// <returns></returns>
+        public async Task SetCode(ChannelWalletTransaction entity)
+        {
+            entity.Code = $"{DateTime.Now:yyyyMMddHHmmss}{new Random(IDGen.NextID().GetHashCode()).Next(1000, 9999)}";
+            var exist = await CheckExist(entity.Code, entity.Id);
+            if (exist)
+            {
+                await SetCode(entity);
+            }
+        }
+
+    }
+}

--
Gitblit v1.9.1