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/ChannelWalletRepository.cs | 66 +++++++++++++++++++++++++++++++++
1 files changed, 66 insertions(+), 0 deletions(-)
diff --git a/ApiTools.Core/Repositories/ChannelWalletRepository.cs b/ApiTools.Core/Repositories/ChannelWalletRepository.cs
new file mode 100644
index 0000000..244a4e6
--- /dev/null
+++ b/ApiTools.Core/Repositories/ChannelWalletRepository.cs
@@ -0,0 +1,66 @@
+锘縰sing Furion.DatabaseAccessor;
+using Furion.DependencyInjection;
+using Furion.DistributedIDGenerator;
+using Furion.FriendlyException;
+using Microsoft.EntityFrameworkCore;
+using pingan.openbank.api.sdk.enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace ApiTools.Core
+{
+ /// <summary>
+ /// 浼佷笟閽卞寘浠撳簱
+ /// </summary>
+ public class ChannelWalletRepository : BaseRepository<ChannelWallet, MasterDbContextLocator>, IScoped
+ {
+ public ChannelWalletRepository(IRepository<ChannelWallet, MasterDbContextLocator> rep) : base(rep)
+ {
+ }
+
+ public override IQueryable<ChannelWallet> GetQueryable(bool noTracking = true)
+ {
+ var q = rep.GetQueryable(noTracking);
+ if (logier != null)
+ {
+ switch (logier.Type)
+ {
+ case EnumUserType.Channel:
+ q = q.Where(it => it.ChannelId == logier.ChannelId);
+ break;
+ case EnumUserType.Operation:
+ break;
+ default:
+ break;
+ }
+ }
+ return q;
+ }
+
+ 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(ChannelWallet 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