diff --git a/Lib/Tiobon.Core.dll b/Lib/Tiobon.Core.dll
index e9bb827c..b22a158d 100644
Binary files a/Lib/Tiobon.Core.dll and b/Lib/Tiobon.Core.dll differ
diff --git a/Lib/Tiobon.Core.xml b/Lib/Tiobon.Core.xml
index 9d386926..41c324e9 100644
--- a/Lib/Tiobon.Core.xml
+++ b/Lib/Tiobon.Core.xml
@@ -4,6 +4,199 @@
Tiobon.Core
+
+ 是否正在运行
+
+
+ 应用有效程序集
+
+
+ 有效程序集类型
+
+
+ 优先使用App.GetService()手动获取服务
+
+
+ 获取Web主机环境,如,是否是开发环境,生产环境等
+
+
+ 获取泛型主机环境,如,是否是开发环境,生产环境等
+
+
+ 全局配置选项
+
+
+
+ 获取请求上下文
+
+
+
+ 解析服务提供器
+
+
+
+
+
+
+ 获取请求生存周期的服务
+
+
+
+
+
+
+ 获取请求生存周期的服务
+
+
+
+
+
+
+ 加载程序集中的所有类型
+
+
+
+
+ 获取配置
+ 强类型选项类
+ TOptions
+
+
+ 获取选项
+ 强类型选项类
+
+ TOptions
+
+
+ 获取选项
+ 强类型选项类
+
+ TOptions
+
+
+ 获取选项
+ 强类型选项类
+
+ TOptions
+
+
+
+ 内部只用于初始化使用
+
+
+
+ 根服务
+
+
+ 获取Web主机环境
+
+
+ 获取泛型主机环境
+
+
+ 配置对象
+
+
+
+ 获取项目程序集,排除所有的系统程序集(Microsoft.***、System.***等)、Nuget下载包
+
+
+
+
+
+ 权限变量配置
+
+
+
+
+ 测试网关授权
+ 可以使用Tiobon.Core项目中的test用户
+ 账号:test
+ 密码:test
+
+
+
+
+
+
+ 路由变量前缀配置
+
+
+
+
+ 前缀名
+ 如果不需要,尽量留空,不要修改
+ 除非一定要在所有的 api 前统一加上特定前缀
+ 前缀在appsettings.json中配置
+
+
+
+
+ RedisMqKey
+
+
+
+
+ appsettings.json操作类
+
+
+
+
+ 封装要操作的字符
+
+ 节点配置
+
+
+
+
+ 递归获取配置信息数组
+
+
+
+
+
+
+
+ 根据路径 configuration["App:Name"];
+
+
+
+
+
+
+ 在控制台输出
+
+ 文本
+ 前颜色
+
+
+
+ 打印错误信息
+
+ 待打印的字符串
+ 想要打印的颜色
+
+
+
+ 打印警告信息
+
+ 待打印的字符串
+ 想要打印的颜色
+
+
+
+ 打印正常信息
+
+ 待打印的字符串
+ 想要打印的颜色
+
+
+
+ 打印成功的信息
+
+ 待打印的字符串
+ 想要打印的颜色
+
时间戳转本地时间-时间戳精确到秒
@@ -433,6 +626,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
表主键
@@ -652,5 +857,370 @@
返回信息
+
+ 添加选项配置
+ 选项类型
+ 服务集合
+ 服务集合
+
+
+ 获取配置路径
+ 选项类型
+
+
+
+
+ 应用选项依赖接口
+ 自动注入配置文件
+ 文件名为Option或Options结尾
+
+
+
+
+ 缓存配置选项
+
+
+
+
+ 是否启用
+
+
+
+
+ Redis连接
+
+
+
+
+ 键值前缀
+
+
+
+
+ 是否启用
+
+
+
+
+ 地址
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 列显示格式信息
+
+
+
+
+ 索引,第几列数据
+
+
+
+
+ 对其方式
+
+
+
+
+ 一列字符串长度
+
+
+
+
+ 对其方式
+
+
+
+
+ 表格头部字符串
+
+
+
+
+ 表格的列
+
+
+
+
+ 行
+
+
+
+
+ 列宽
+
+
+
+
+ 空白字符数量
+
+
+
+
+ 对其方式
+
+
+
+
+ 是否显示行数
+
+
+
+
+ 表格显示样式
+ 每次设置样子后就会重置 StyleInfo
+
+
+
+
+ 通过 Format 获得到表格显示样式
+
+
+
+
+ 每一列的宽度
+
+
+
+
+ 每一列显示的基本信息
+
+
+
+
+ 添加列
+
+ 列明
+ 列的宽
+
+
+
+
+ 添加行
+
+ 该行数据
+
+
+
+
+ 加载 List 对象的数据
+
+
+
+
+
+
+
+ 获取表格字符串
+
+
+
+
+
+ 绘制表格
+
+ 样式
+ title颜色
+
+
+
+ 获取完成头
+
+
+
+
+
+ 获取现有数据
+
+
+
+
+
+ 获取新行数据
+
+
+
+
+
+
+ 获取底
+
+
+
+
+
+ 获取列名
+
+
+
+
+
+
+ 获取列值
+
+ 类型
+ 数据
+ 列名
+
+
+
+
+ 绘制表格需要的信息
+
+
+
+
+ 顶部和底部字符串分隔线
+
+
+
+
+ 分隔线
+
+
+
+
+ 标题
+
+
+
+
+ 头部
+
+
+
+
+ 数据
+
+
+
+
+ 按照现有数据计算每列最大宽度
+
+ 列信息
+ 现有行数据
+ 每一列显示宽度
+
+
+
+ 将填充格式转成字符串
+ 表头和数据行会用到
+
+ 一行的显示格式信息
+ 一行要显示的数据
+ 间隔符
+ 每列留白数
+
+
+
+
+ 获取title 字符串
+
+ >
+ 标题字符串信息
+ 列两端留白数
+ 每列之间分割字符串
+
+
+
+
+ 获取每行之间的分割行字符串
+
+ 列宽信息
+ 每列之间分割字符串
+ 列两端留白数
+
+
+
+
+ 获取头部和底部字符串
+
+ 列宽信息
+ 每列之间分割字符串
+ 列两端留白数
+
+
+
+
+ 获取表格显示样式
+
+
+
+
+
+
+ 获取文本长度,区分全角半角
+ 全角算两个字符
+
+
+
+
+
+ 获取中文文本
+
+
+
+
+
+
+ 表格显示样式
+
+
+
+
+ 默认格式的表格
+
+
+
+
+ Markdwon格式的表格
+
+
+
+
+ 交替格式的表格
+
+
+
+
+ 最简格式的表格
+
+
+
+
+ 表格显示样式信息
+ 通过 Format 获取到的
+
+
+
+
+ 每一列数据之间的间隔字符串
+
+
+
+
+ 是否显示顶部,底部,和每一行数据之间的横向边框
+
+
+
+
+ 边角字符串
+
+
diff --git a/Tiobon.CodeGenerator/Program.cs b/Tiobon.CodeGenerator/Program.cs
index 8e883f8b..345be1d0 100644
--- a/Tiobon.CodeGenerator/Program.cs
+++ b/Tiobon.CodeGenerator/Program.cs
@@ -1,5 +1,6 @@
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
+using Tiobon.Core;
using Tiobon.Core.Common;
using Tiobon.Core.Common.DB;
using Tiobon.Core.Common.DB.Dapper.Extensions;
diff --git a/Tiobon.Core.Api/Controllers/Authorize/AuthorizeController.cs b/Tiobon.Core.Api/Controllers/Authorize/AuthorizeController.cs
index c01cfaea..dd42da79 100644
--- a/Tiobon.Core.Api/Controllers/Authorize/AuthorizeController.cs
+++ b/Tiobon.Core.Api/Controllers/Authorize/AuthorizeController.cs
@@ -3,7 +3,7 @@ using System.Security.Claims;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Tiobon.Core.AuthHelper;
using Tiobon.Core.AuthHelper.OverWrite;
-using Tiobon.Core.Common.Swagger;
+using Tiobon.Core.Swagger;
namespace Tiobon.Core.Controllers;
diff --git a/Tiobon.Core.Api/Controllers/LoginController.cs b/Tiobon.Core.Api/Controllers/LoginController.cs
index 61ef2745..4713a197 100644
--- a/Tiobon.Core.Api/Controllers/LoginController.cs
+++ b/Tiobon.Core.Api/Controllers/LoginController.cs
@@ -3,7 +3,7 @@ using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using Tiobon.Core.AuthHelper;
using Tiobon.Core.AuthHelper.OverWrite;
-using Tiobon.Core.Common.Swagger;
+using Tiobon.Core.Swagger;
namespace Tiobon.Core.Controllers;
diff --git a/Tiobon.Core.Api/Program.cs b/Tiobon.Core.Api/Program.cs
index 2221f322..9aaf8ca8 100644
--- a/Tiobon.Core.Api/Program.cs
+++ b/Tiobon.Core.Api/Program.cs
@@ -10,7 +10,7 @@ using Serilog;
using System.IdentityModel.Tokens.Jwt;
using System.Reflection;
using Tiobon.Core;
-using Tiobon.Core.Common.Core;
+using Tiobon.Core.Core;
using Tiobon.Core.Common.DB.Dapper.Extensions;
using Tiobon.Core.Extensions;
using Tiobon.Core.Extensions.Apollo;
diff --git a/Tiobon.Core.Api/Views/Ghrh_ResumeTemplatePreview/Index.cshtml b/Tiobon.Core.Api/Views/Ghrh_ResumeTemplatePreview/Index.cshtml
index e1528a00..7127fda0 100644
--- a/Tiobon.Core.Api/Views/Ghrh_ResumeTemplatePreview/Index.cshtml
+++ b/Tiobon.Core.Api/Views/Ghrh_ResumeTemplatePreview/Index.cshtml
@@ -1,4 +1,5 @@
-@using Tiobon.Core.Model.ViewModels.Extend
+@using Tiobon.Core
+@using Tiobon.Core.Model.ViewModels.Extend
@{
Layout = "~/Views/Shared/_Layout.cshtml";
diff --git a/Tiobon.Core.Common/App.cs b/Tiobon.Core.Common/App.cs
deleted file mode 100644
index 7a5334be..00000000
--- a/Tiobon.Core.Common/App.cs
+++ /dev/null
@@ -1,190 +0,0 @@
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
-using Microsoft.Extensions.Options;
-using System.Reflection;
-using Tiobon.Core.Common.Core;
-using Tiobon.Core.Common.Extensions;
-using Tiobon.Core.Common.HttpContextUser;
-using Tiobon.Core.Common.Option.Core;
-
-namespace Tiobon.Core.Common;
-
-public class App
-{
- static App()
- {
- EffectiveTypes = Assemblies.SelectMany(GetTypes);
- }
-
- private static bool _isRun;
-
- /// 是否正在运行
- public static bool IsBuild { get; set; }
-
- public static bool IsRun
- {
- get => _isRun;
- set => _isRun = IsBuild = value;
- }
-
- /// 应用有效程序集
- public static readonly IEnumerable Assemblies = RuntimeExtension.GetAllAssemblies();
-
- /// 有效程序集类型
- public static readonly IEnumerable EffectiveTypes;
-
- /// 优先使用App.GetService()手动获取服务
- public static IServiceProvider RootServices => IsRun || IsBuild ? InternalApp.RootServices : null;
-
- /// 获取Web主机环境,如,是否是开发环境,生产环境等
- public static IWebHostEnvironment WebHostEnvironment => InternalApp.WebHostEnvironment;
-
- /// 获取泛型主机环境,如,是否是开发环境,生产环境等
- public static IHostEnvironment HostEnvironment => InternalApp.HostEnvironment;
-
- /// 全局配置选项
- public static IConfiguration Configuration => InternalApp.Configuration;
-
- ///
- /// 获取请求上下文
- ///
- public static HttpContext HttpContext => RootServices?.GetService()?.HttpContext;
-
- public static IUser User => GetService();
-
- #region Service
-
- /// 解析服务提供器
- ///
- ///
- ///
- ///
- public static IServiceProvider GetServiceProvider(Type serviceType, bool mustBuild = false, bool throwException = true)
- {
- if (App.HostEnvironment == null || App.RootServices != null &&
- InternalApp.InternalServices
- .Where((u =>
- u.ServiceType ==
- (serviceType.IsGenericType ? serviceType.GetGenericTypeDefinition() : serviceType)))
- .Any((u => u.Lifetime == ServiceLifetime.Singleton)))
- return App.RootServices;
-
- //获取请求生存周期的服务
- if (HttpContext?.RequestServices != null)
- return HttpContext.RequestServices;
-
- if (App.RootServices != null)
- {
- IServiceScope scope = RootServices.CreateScope();
- return scope.ServiceProvider;
- }
-
- if (mustBuild)
- {
- if (throwException)
- {
- throw new ApplicationException("当前不可用,必须要等到 WebApplication Build后");
- }
-
- return default;
- }
-
- ServiceProvider serviceProvider = InternalApp.InternalServices.BuildServiceProvider();
- return serviceProvider;
- }
-
- public static TService GetService(bool mustBuild = true) where TService : class =>
- App.GetService(typeof(TService), null, mustBuild) as TService;
-
- /// 获取请求生存周期的服务
- ///
- ///
- ///
- ///
- public static TService GetService(IServiceProvider serviceProvider, bool mustBuild = true)
- where TService : class => (serviceProvider ?? App.GetServiceProvider(typeof(TService), mustBuild, false))?.GetService();
-
- /// 获取请求生存周期的服务
- ///
- ///
- ///
- ///
- public static object GetService(Type type, IServiceProvider serviceProvider = null, bool mustBuild = true) =>
- (serviceProvider ?? App.GetServiceProvider(type, mustBuild, false))?.GetService(type);
-
- #endregion
-
- #region private
-
- /// 加载程序集中的所有类型
- ///
- ///
- private static IEnumerable GetTypes(Assembly ass)
- {
- Type[] source = Array.Empty();
- try
- {
- source = ass.GetTypes();
- }
- catch
- {
- $@"Error load `{ass.FullName}` assembly.".WriteErrorLine();
- }
-
- return source.Where(u => u.IsPublic);
- }
-
- #endregion
-
- #region Options
-
- /// 获取配置
- /// 强类型选项类
- /// TOptions
- public static TOptions GetConfig()
- where TOptions : class, IConfigurableOptions
- {
- TOptions instance = App.Configuration
- .GetSection(ConfigurableOptions.GetConfigurationPath(typeof(TOptions)))
- .Get();
- return instance;
- }
-
- /// 获取选项
- /// 强类型选项类
- ///
- /// TOptions
- public static TOptions GetOptions(IServiceProvider serviceProvider = null) where TOptions : class, new()
- {
- IOptions service = App.GetService>(serviceProvider ?? App.RootServices, false);
- return service?.Value;
- }
-
- /// 获取选项
- /// 强类型选项类
- ///
- /// TOptions
- public static TOptions GetOptionsMonitor(IServiceProvider serviceProvider = null)
- where TOptions : class, new()
- {
- IOptionsMonitor service =
- App.GetService>(serviceProvider ?? App.RootServices, false);
- return service?.CurrentValue;
- }
-
- /// 获取选项
- /// 强类型选项类
- ///
- /// TOptions
- public static TOptions GetOptionsSnapshot(IServiceProvider serviceProvider = null)
- where TOptions : class, new()
- {
- IOptionsSnapshot service = App.GetService>(serviceProvider, false);
- return service?.Value;
- }
-
- #endregion
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/Core/InternalApp.cs b/Tiobon.Core.Common/Core/InternalApp.cs
deleted file mode 100644
index b79490c9..00000000
--- a/Tiobon.Core.Common/Core/InternalApp.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Hosting;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Hosting;
-
-namespace Tiobon.Core.Common.Core;
-
-///
-/// 内部只用于初始化使用
-///
-public static class InternalApp
-{
- internal static IServiceCollection InternalServices;
-
- /// 根服务
- internal static IServiceProvider RootServices;
-
- /// 获取Web主机环境
- internal static IWebHostEnvironment WebHostEnvironment;
-
- /// 获取泛型主机环境
- internal static IHostEnvironment HostEnvironment;
-
- /// 配置对象
- internal static IConfiguration Configuration;
-
- public static void ConfigureApplication(this WebApplicationBuilder wab)
- {
- HostEnvironment = wab.Environment;
- WebHostEnvironment = wab.Environment;
- InternalServices = wab.Services;
- }
-
- public static void ConfigureApplication(this IConfiguration configuration)
- {
- Configuration = configuration;
- }
-
- public static void ConfigureApplication(this IHost app)
- {
- RootServices = app.Services;
- }
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/Extensions/HttpContextExtension.cs b/Tiobon.Core.Common/Extensions/HttpContextExtension.cs
deleted file mode 100644
index b31f8c9f..00000000
--- a/Tiobon.Core.Common/Extensions/HttpContextExtension.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using Microsoft.AspNetCore.Http;
-
-namespace Tiobon.Core.Common.Extensions;
-
-public static class HttpContextExtension
-{
- public static ISession GetSession(this HttpContext context)
- {
- try
- {
- return context.Session;
- }
- catch (Exception)
- {
- return default;
- }
- }
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/Extensions/RuntimeExtension.cs b/Tiobon.Core.Common/Extensions/RuntimeExtension.cs
deleted file mode 100644
index ff496492..00000000
--- a/Tiobon.Core.Common/Extensions/RuntimeExtension.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-using Microsoft.Extensions.DependencyModel;
-using Serilog;
-using System.Reflection;
-using System.Runtime.Loader;
-
-namespace Tiobon.Core.Common.Extensions;
-
-public static class RuntimeExtension
-{
- ///
- /// 获取项目程序集,排除所有的系统程序集(Microsoft.***、System.***等)、Nuget下载包
- ///
- ///
- public static IList GetAllAssemblies()
- {
- var list = new List();
- var deps = DependencyContext.Default;
- //只加载项目中的程序集
- var libs = deps.CompileLibraries.Where(lib => !lib.Serviceable && lib.Type == "project"); //排除所有的系统程序集、Nuget下载包
- foreach (var lib in libs)
- {
- try
- {
- var assembly = AssemblyLoadContext.Default.LoadFromAssemblyName(new AssemblyName(lib.Name));
- list.Add(assembly);
- }
- catch (Exception e)
- {
- Log.Debug(e, "GetAllAssemblies Exception:{ex}", e.Message);
- }
- }
-
- return list;
- }
-
- public static Assembly GetAssembly(string assemblyName)
- {
- return GetAllAssemblies().FirstOrDefault(assembly => assembly.FullName.Contains(assemblyName));
- }
-
- public static IList GetAllTypes()
- {
- var list = new List();
- foreach (var assembly in GetAllAssemblies())
- {
- var typeInfos = assembly.DefinedTypes;
- foreach (var typeInfo in typeInfos)
- {
- list.Add(typeInfo.AsType());
- }
- }
-
- return list;
- }
-
- public static IList GetTypesByAssembly(string assemblyName)
- {
- var list = new List();
- var assembly = AssemblyLoadContext.Default.LoadFromAssemblyName(new AssemblyName(assemblyName));
- var typeInfos = assembly.DefinedTypes;
- foreach (var typeInfo in typeInfos)
- {
- list.Add(typeInfo.AsType());
- }
-
- return list;
- }
-
- public static Type GetImplementType(string typeName, Type baseInterfaceType)
- {
- return GetAllTypes().FirstOrDefault(t =>
- {
- if (t.Name == typeName &&
- t.GetTypeInfo().GetInterfaces().Any(b => b.Name == baseInterfaceType.Name))
- {
- var typeInfo = t.GetTypeInfo();
- return typeInfo.IsClass && !typeInfo.IsAbstract && !typeInfo.IsGenericType;
- }
-
- return false;
- });
- }
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/GlobalVar/GlobalVars.cs b/Tiobon.Core.Common/GlobalVar/GlobalVars.cs
deleted file mode 100644
index 0312228e..00000000
--- a/Tiobon.Core.Common/GlobalVar/GlobalVars.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-namespace Tiobon.Core;
-
-///
-/// 权限变量配置
-///
-public static class Permissions
-{
- public const string Name = "Permission";
-
- ///
- /// 测试网关授权
- /// 可以使用Tiobon.Core项目中的test用户
- /// 账号:test
- /// 密码:test
- ///
- public const string GWName = "GW";
-
- ///
- /// 当前项目是否启用IDS4权限方案
- /// true:表示启动IDS4
- /// false:表示使用JWT
- public static bool IsUseIds4 = false;
-
- ///
- /// 当前项目是否启用Authing权限方案
- /// true:表示启动
- /// false:表示使用JWT
- public static bool IsUseAuthing = false;
-}
-
-///
-/// 路由变量前缀配置
-///
-public static class RoutePrefix
-{
- ///
- /// 前缀名
- /// 如果不需要,尽量留空,不要修改
- /// 除非一定要在所有的 api 前统一加上特定前缀
- /// 前缀在appsettings.json中配置
- ///
- public static string Name = "";
-}
-
-///
-/// RedisMqKey
-///
-public static class RedisMqKey
-{
- public const string Loging = "Loging";
-}
diff --git a/Tiobon.Core.Common/Helper/Appsettings.cs b/Tiobon.Core.Common/Helper/Appsettings.cs
deleted file mode 100644
index 21599e43..00000000
--- a/Tiobon.Core.Common/Helper/Appsettings.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.Configuration.Json;
-
-namespace Tiobon.Core.Common;
-
-///
-/// appsettings.json操作类
-///
-public class AppSettings
-{
- public static IConfiguration Configuration { get; set; }
- static string contentPath { get; set; }
-
- public AppSettings(string contentPath)
- {
- string Path = "appsettings.json";
-
- //如果你把配置文件 是 根据环境变量来分开了,可以这样写
- //Path = $"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT")}.json";
-
- Configuration = new ConfigurationBuilder()
- .SetBasePath(contentPath)
- .Add(new JsonConfigurationSource
- {
- Path = Path, Optional = false, ReloadOnChange = true
- }) //这样的话,可以直接读目录里的json文件,而不是 bin 文件夹下的,所以不用修改复制属性
- .Build();
- }
-
- public AppSettings(IConfiguration configuration)
- {
- Configuration = configuration;
- }
-
- ///
- /// 封装要操作的字符
- ///
- /// 节点配置
- ///
- public static string app(params string[] sections)
- {
- try
- {
- if (sections.Any())
- {
- return Configuration[string.Join(":", sections)];
- }
- }
- catch (Exception)
- {
- }
-
- return "";
- }
-
- ///
- /// 递归获取配置信息数组
- ///
- ///
- ///
- ///
- public static List app(params string[] sections)
- {
- List list = new List();
- // 引用 Microsoft.Extensions.Configuration.Binder 包
- Configuration.Bind(string.Join(":", sections), list);
- return list;
- }
-
-
- ///
- /// 根据路径 configuration["App:Name"];
- ///
- ///
- ///
- public static string GetValue(string sectionsPath)
- {
- try
- {
- return Configuration[sectionsPath];
- }
- catch (Exception)
- {
- }
-
- return "";
- }
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/Helper/Console/ConsoleHelper.cs b/Tiobon.Core.Common/Helper/Console/ConsoleHelper.cs
deleted file mode 100644
index b2be8e9e..00000000
--- a/Tiobon.Core.Common/Helper/Console/ConsoleHelper.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-namespace Tiobon.Core.Common;
-
-public static class ConsoleHelper
-{
- private static readonly object _objLock = new();
-
- ///
- /// 在控制台输出
- ///
- /// 文本
- /// 前颜色
- public static void WriteColorLine(string str, ConsoleColor color)
- {
- lock (_objLock)
- {
- ConsoleColor currentForeColor = Console.ForegroundColor;
- Console.ForegroundColor = color;
- Console.WriteLine(str);
- Console.ForegroundColor = currentForeColor;
- }
- }
-
- ///
- /// 打印错误信息
- ///
- /// 待打印的字符串
- /// 想要打印的颜色
- public static void WriteErrorLine(this string str, ConsoleColor color = ConsoleColor.Red)=> WriteColorLine(str, color);
-
- ///
- /// 打印警告信息
- ///
- /// 待打印的字符串
- /// 想要打印的颜色
- public static void WriteWarningLine(this string str, ConsoleColor color = ConsoleColor.Yellow)=> WriteColorLine(str, color);
-
- ///
- /// 打印正常信息
- ///
- /// 待打印的字符串
- /// 想要打印的颜色
- public static void WriteInfoLine(this string str, ConsoleColor color = ConsoleColor.White)=> WriteColorLine(str, color);
-
- ///
- /// 打印成功的信息
- ///
- /// 待打印的字符串
- /// 想要打印的颜色
- public static void WriteSuccessLine(this string str, ConsoleColor color = ConsoleColor.Green)=> WriteColorLine(str, color);
-}
diff --git a/Tiobon.Core.Common/Helper/Console/Table/ColumnShowFormat.cs b/Tiobon.Core.Common/Helper/Console/Table/ColumnShowFormat.cs
deleted file mode 100644
index af6fc50b..00000000
--- a/Tiobon.Core.Common/Helper/Console/Table/ColumnShowFormat.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-namespace System;
-
-///
-/// 列显示格式信息
-///
-public class ColumnShowFormat
-{
- public ColumnShowFormat(int index, int strLength, Alignment alignment)
- {
- Index = index;
- StrLength = strLength;
- Alignment = alignment;
- }
-
- ///
- /// 索引,第几列数据
- ///
- public int Index { get; set; }
-
- ///
- /// 对其方式
- ///
- public Alignment Alignment { get; set; }
-
- ///
- /// 一列字符串长度
- ///
- public int StrLength { get; set; }
-}
-
-///
-/// 对其方式
-///
-public enum Alignment
-{
- Left,
- Right
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/Helper/Console/Table/ConsoleTable.cs b/Tiobon.Core.Common/Helper/Console/Table/ConsoleTable.cs
deleted file mode 100644
index 0395b1f2..00000000
--- a/Tiobon.Core.Common/Helper/Console/Table/ConsoleTable.cs
+++ /dev/null
@@ -1,327 +0,0 @@
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using System.Text;
-using Tiobon.Core.Common;
-
-namespace System;
-
-public class ConsoleTable
-{
- #region 属性
-
- ///
- /// 表格头部字符串
- ///
- public string TitleString { get; set; }
-
- ///
- /// 表格的列
- ///
- public IList Columns
- {
- get
- {
- if (_columns == null) _columns = new List();
- return _columns;
- }
- set
- {
- _columns = value;
- _finalColumnWides = new List();
- }
- }
-
- ///
- /// 行
- ///
- public List Rows { get; set; } = new List();
-
- ///
- /// 列宽
- ///
- public List ColumnWides { get; set; } = new List();
-
- ///
- /// 空白字符数量
- ///
- public int ColumnBlankNum { get; set; } = 4;
-
- ///
- /// 对其方式
- ///
- public Alignment Alignment { get; set; } = Alignment.Left;
-
- ///
- /// 是否显示行数
- ///
- public bool EnableCount { get; set; } = false;
-
- ///
- /// 表格显示样式
- /// 每次设置样子后就会重置 StyleInfo
- ///
- public TableStyle TableStyle
- {
- get
- {
- return _tableStyle;
- }
- set
- {
- if (_tableStyle == value) return;
- _tableStyle = value;
- _formatInfo = null;
- }
- }
-
- #endregion 属性
-
- #region 私有信息
- private IList _columns;
- private TableStyle _tableStyle;
- private StyleInfo _formatInfo;
- private List _columnShowFormats = new List();
- private List _finalColumnWides = new List();
-
- ///
- /// 通过 Format 获得到表格显示样式
- ///
- private StyleInfo FormatInfo
- {
- get
- {
- if (_formatInfo == null)
- _formatInfo = _tableStyle.GetFormatInfo();//得到样式信息
- return _formatInfo;
- }
- set
- {
- _formatInfo = value;
- }
- }
-
- ///
- /// 每一列的宽度
- ///
- private List FinalColumnWides
- {
- get
- {
- if (_finalColumnWides is null || _finalColumnWides.Count < 1)
- {
- // 得到每一列最大的宽度
- List _columnWides = Columns.GetColumnWides(Rows);
- // 替换用户输入长度
- ColumnWides ??= new List();
- for (int i = 0; i < ColumnWides.Count; i++) _columnWides[i] = ColumnWides[i];
- _finalColumnWides = _columnWides;
- }
- return _finalColumnWides;
- }
- }
-
- ///
- /// 每一列显示的基本信息
- ///
- private List ColumnShowFormats
- {
- get
- {
- if (_columnShowFormats.Count == 0)
- {
- for (int i = 0; i < Columns.Count; i++) _columnShowFormats.Add(new ColumnShowFormat(i, FinalColumnWides[i], Alignment));
- }
- return _columnShowFormats;
- }
- }
-
- #endregion 私有信息
-
- #region 配置数据
-
- ///
- /// 添加列
- ///
- /// 列明
- /// 列的宽
- ///
- public ConsoleTable AddColumn(string columnName, int columnWide = 0)
- {
- Columns.Add(columnName);
- columnWide = columnWide == 0 ? columnName.Length : columnWide;
- _finalColumnWides.Add(columnWide);
- return this;
- }
-
- ///
- /// 添加行
- ///
- /// 该行数据
- ///
- public ConsoleTable AddRow(params string[] values)
- {
- _ = values ?? throw new ArgumentNullException(nameof(values));
-
- Rows.Add(values);
- return this;
- }
-
- ///
- /// 加载 List 对象的数据
- ///
- ///
- ///
- ///
- public static ConsoleTable From(IEnumerable values)
- {
- ConsoleTable table = new();
-
- List columns = GetColumns().Where(c => !string.IsNullOrWhiteSpace(c)).ToList();
- columns.ForEach(c =>
- {
- table.AddColumn(c);
- });
-
- values.ToList().ForEach(value =>
- {
- table.AddRow(columns.Select(c => GetColumnValue(value, c)).ToArray());
- });
-
- return table;
- }
-
- #endregion 配置数据
-
- ///
- /// 获取表格字符串
- ///
- ///
- public override string ToString()
- {
- StringBuilder builder = new();
-
- builder.AppendLine(GetHeader());
- builder.AppendLine(GetExistData());
- builder.AppendLine(GetEnd());
-
- return builder.ToString();
- }
-
- ///
- /// 绘制表格
- ///
- /// 样式
- /// title颜色
- public void Writer(ConsoleColor color = ConsoleColor.White)
- {
- ConsoleHelper.WriteColorLine(GetHeader(), color);
- ConsoleHelper.WriteInfoLine(GetExistData());
- ConsoleHelper.WriteColorLine(GetEnd(), color);
- }
-
- #region 帮助方法
-
- ///
- /// 获取完成头
- ///
- ///
- public string GetHeader()
- {
- // 创建顶部和底部分隔线
- string top_DownDividerdivider = FinalColumnWides.GetTopAndDwon(FormatInfo.AngleStr, ColumnBlankNum);
- // 创建分隔线
- string divider = FinalColumnWides.GetDivider(FormatInfo.AngleStr, ColumnBlankNum);
- // 获取标题字符串
- string tilte = FinalColumnWides.GetTitleStr(TitleString, ColumnBlankNum, FormatInfo.DelimiterStr);
- // 得到头部字符串
- string headers = ColumnShowFormats.FillFormatTostring(Columns.ToArray(), FormatInfo.DelimiterStr, ColumnBlankNum);
-
- //绘制表格头
- StringBuilder top = new();
- if (FormatInfo.IsShowTop_Down_DataBorder) top.AppendLine(top_DownDividerdivider);
- if (!string.IsNullOrWhiteSpace(tilte))
- {
- top.AppendLine(tilte);
- top.AppendLine(divider);
- }
- top.AppendLine(headers);
- top.AppendLine(divider);
- return top.ToString().Trim();
- }
-
- ///
- /// 获取现有数据
- ///
- ///
- public string GetExistData()
- {
- // 创建分隔线
- string divider = FinalColumnWides.GetDivider(FormatInfo.AngleStr, ColumnBlankNum);
- // 得到每行数据的字符串
- List rowStrs = Rows.Select(row => ColumnShowFormats.FillFormatTostring(row, FormatInfo.DelimiterStr, ColumnBlankNum)).ToList();
- StringBuilder data = new();
- for (int i = 0; i < rowStrs.Count; i++)
- {
- if (FormatInfo.IsShowTop_Down_DataBorder && i != 0) data.AppendLine(divider);
- data.AppendLine(rowStrs[i]);
- }
- return data.ToString().Trim();
- }
-
- ///
- /// 获取新行数据
- ///
- ///
- ///
- public string GetNewRow(string[] row)
- {
- if (row is null) return "";
-
- Rows.Add(row);
- //内容
- StringBuilder data = new();
- if (Rows.Count > 1) data.AppendLine(FinalColumnWides.GetDivider(FormatInfo.AngleStr, ColumnBlankNum));
- data.AppendLine(ColumnShowFormats.FillFormatTostring(row, FormatInfo.DelimiterStr, ColumnBlankNum));
- return data.ToString().Trim();
- }
-
- ///
- /// 获取底
- ///
- ///
- public string GetEnd()
- {
- StringBuilder down = new();
- if (FormatInfo.IsShowTop_Down_DataBorder) down.AppendLine(FinalColumnWides.GetTopAndDwon(FormatInfo.AngleStr, ColumnBlankNum));
- if (EnableCount) down.AppendLine($" Count: {Rows.Count}");
- return down.ToString().Trim();
- }
-
- ///
- /// 获取列名
- ///
- ///
- ///
- private static IEnumerable GetColumns()
- {
- return typeof(T).GetProperties().Select(x => x.Name).ToArray();
- }
-
- ///
- /// 获取列值
- ///
- /// 类型
- /// 数据
- /// 列名
- ///
- private static string GetColumnValue(T obj, string column)
- {
- if (obj == null) return null;
-
- JObject o = obj as JObject ?? (JObject)JsonConvert.DeserializeObject(JsonConvert.SerializeObject(obj));
-
- return o.GetValue(column).ToString();
- }
-
- #endregion 帮助方法
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/Helper/Console/Table/DrawTableInfo.cs b/Tiobon.Core.Common/Helper/Console/Table/DrawTableInfo.cs
deleted file mode 100644
index 2eb89e4a..00000000
--- a/Tiobon.Core.Common/Helper/Console/Table/DrawTableInfo.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-namespace System;
-
-///
-/// 绘制表格需要的信息
-///
-public class DrawTableInfo
-{
- ///
- /// 顶部和底部字符串分隔线
- ///
- public string Top_DownDivider { get; set; }
-
- ///
- /// 分隔线
- ///
- public string Divider { get; set; }
-
- ///
- /// 标题
- ///
- public string Title { get; set; }
-
- ///
- /// 头部
- ///
- public string Header { get; set; }
-
- ///
- /// 数据
- ///
- public List Data { get; set; }
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/Helper/Console/Table/TableExtension.cs b/Tiobon.Core.Common/Helper/Console/Table/TableExtension.cs
deleted file mode 100644
index 8f443c05..00000000
--- a/Tiobon.Core.Common/Helper/Console/Table/TableExtension.cs
+++ /dev/null
@@ -1,148 +0,0 @@
-using System.Text.RegularExpressions;
-using Tiobon.Core;
-
-namespace System;
-
-public static class TableExtension
-{
- ///
- /// 按照现有数据计算每列最大宽度
- ///
- /// 列信息
- /// 现有行数据
- /// 每一列显示宽度
- public static List GetColumnWides(this IList columns, IList rows)
- {
- List columnLengths = columns.Select((t, i) =>
- rows.Select(x => x[i])//得到所有行当前列的数据
- .Union(new[] { columns[i] })//连接当前列标题
- .Where(x => x != null)
- .Select(x => x.ObjToString().FullHalfLength())//得到该列每一行的字符串长度(计算中文占用两格)
- .Max())//到该列中长度最大的以列
- .ToList();
- return columnLengths;
- }
-
- ///
- /// 将填充格式转成字符串
- /// 表头和数据行会用到
- ///
- /// 一行的显示格式信息
- /// 一行要显示的数据
- /// 间隔符
- /// 每列留白数
- ///
- public static string FillFormatTostring(this List format, string[] objs, string delimiterStr, int columnBlankNum)
- {
- string formatStr = string.Empty;
- format.ForEach(f =>
- {
- string ali = f.Alignment == Alignment.Right ? "" : "-";
- string val = objs[f.Index].ObjToString();
- if (val.Length > f.StrLength)
- {
- //val = val[0..f.StrLength];
- //val = val[0..(val.Length - val.GetChineseText().Length)];
- objs[f.Index] = "...";//标记超出长度
- }
-
- if (!string.IsNullOrWhiteSpace(formatStr)) formatStr += $"{"".PadLeft(columnBlankNum, ' ')}";
- int alignmentStrLength = Math.Max(f.StrLength - objs[f.Index].ObjToString().GetChineseText().Length, 0);//对其填充空格数量
- formatStr += $"{delimiterStr}{"".PadLeft(columnBlankNum, ' ')}{{{f.Index},{ali}{alignmentStrLength}}}";
- });
- formatStr += $"{"".PadLeft(columnBlankNum, ' ')}{delimiterStr}";
- return string.Format(formatStr, objs);
- }
-
- ///
- /// 获取title 字符串
- ///
- /// >
- /// 标题字符串信息
- /// 列两端留白数
- /// 每列之间分割字符串
- ///
- public static string GetTitleStr(this List columnWides, string titleStr, int columnBlankNum, string delimiterStr)
- {
- if (string.IsNullOrWhiteSpace(titleStr)) return "";
- //一行的宽度
- int rowWide = columnWides.Sum() + columnWides.Count * 2 * columnBlankNum + columnWides.Count + 1;
- int blankNum = (rowWide - titleStr.FullHalfLength()) / 2 - 1;
- string tilte = $"{delimiterStr}{"".PadLeft(blankNum, ' ')}{titleStr}{"".PadLeft(blankNum, ' ')}{delimiterStr}";
- if (tilte.FullHalfLength() != rowWide) tilte = tilte.Replace($" {delimiterStr}", $" {delimiterStr}");
- return tilte;
- }
-
- ///
- /// 获取每行之间的分割行字符串
- ///
- /// 列宽信息
- /// 每列之间分割字符串
- /// 列两端留白数
- ///
- public static string GetDivider(this List columnWides, string angleStr, int columnBlankNum)
- {
- string divider = "";
- columnWides.ForEach(i =>
- {
- divider += $"{angleStr}{"".PadRight(i + columnBlankNum * 2, '-')}";
- });
- divider += angleStr;
- return divider;
- }
-
- ///
- /// 获取头部和底部字符串
- ///
- /// 列宽信息
- /// 每列之间分割字符串
- /// 列两端留白数
- ///
- public static string GetTopAndDwon(this List columnWides, string angleStr, int columnBlankNum)
- {
- string top_DownDividerdivider = "";
- columnWides.ForEach(i =>
- {
- if (string.IsNullOrWhiteSpace(top_DownDividerdivider)) top_DownDividerdivider += $"{angleStr}{"".PadRight(i + columnBlankNum * 2, '-')}";
- else top_DownDividerdivider += $"{"".PadRight(i + columnBlankNum * 2 + 1, '-')}";
- });
- top_DownDividerdivider += angleStr;
- return top_DownDividerdivider;
- }
-
- ///
- /// 获取表格显示样式
- ///
- ///
- ///
- public static StyleInfo GetFormatInfo(this TableStyle format)
- {
- return format switch
- {
- TableStyle.Default => new StyleInfo("|", true, "-"),
- TableStyle.MarkDown => new StyleInfo("|", false, "|"),
- TableStyle.Alternative => new StyleInfo("|", true, "+"),
- TableStyle.Minimal => new StyleInfo("", false, "-"),
- _ => new StyleInfo(),
- };
- }
-
- ///
- /// 获取文本长度,区分全角半角
- /// 全角算两个字符
- ///
- ///
- public static int FullHalfLength(this string text)
- {
- return Regex.Replace(text, "[^\x00-\xff]", "**").Length;
- //可使用以下方法,不过要看在不同编码中字节数
- //return Encoding.Default.GetByteCount(text);
- }
-
- ///
- /// 获取中文文本
- ///
- ///
- ///
- public static string GetChineseText(this string text) => Regex.Replace(text, "[\x00-\xff]", "");
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/Helper/Console/Table/TableStyle.cs b/Tiobon.Core.Common/Helper/Console/Table/TableStyle.cs
deleted file mode 100644
index 4d310a41..00000000
--- a/Tiobon.Core.Common/Helper/Console/Table/TableStyle.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-namespace System;
-
-///
-/// 表格显示样式
-///
-public enum TableStyle
-{
- ///
- /// 默认格式的表格
- ///
- Default = 0,
-
- ///
- /// Markdwon格式的表格
- ///
- MarkDown = 1,
-
- ///
- /// 交替格式的表格
- ///
- Alternative = 2,
-
- ///
- /// 最简格式的表格
- ///
- Minimal = 3
-}
-
-///
-/// 表格显示样式信息
-/// 通过 Format 获取到的
-///
-public class StyleInfo
-{
- public StyleInfo(string delimiterStr = "|", bool isShowTop_Down_DataBorder = true, string angleStr = "-")
- {
- DelimiterStr = delimiterStr;
- IsShowTop_Down_DataBorder = isShowTop_Down_DataBorder;
- AngleStr = angleStr;
- }
-
- ///
- /// 每一列数据之间的间隔字符串
- ///
- public string DelimiterStr { get; set; }
-
- ///
- /// 是否显示顶部,底部,和每一行数据之间的横向边框
- ///
- public bool IsShowTop_Down_DataBorder { get; set; }
-
- ///
- /// 边角字符串
- ///
- public string AngleStr { get; set; }
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/HttpContextUser/AspNetUser.cs b/Tiobon.Core.Common/HttpContextUser/AspNetUser.cs
deleted file mode 100644
index 7926a806..00000000
--- a/Tiobon.Core.Common/HttpContextUser/AspNetUser.cs
+++ /dev/null
@@ -1,177 +0,0 @@
-using Microsoft.AspNetCore.Http;
-using Microsoft.Extensions.Logging;
-using System.IdentityModel.Tokens.Jwt;
-using System.Security.Claims;
-using Tiobon.Core.Common.Swagger;
-using Tiobon.Core.Model.Entity;
-
-namespace Tiobon.Core.Common.HttpContextUser;
-
-public class AspNetUser : IUser
-{
- private readonly IHttpContextAccessor _accessor;
- private readonly ILogger _logger;
-
- public AspNetUser(IHttpContextAccessor accessor, ILogger logger)
- {
- _accessor = accessor;
- _logger = logger;
- }
-
- public string Name => GetName();
-
- private string GetName()
- {
- if (IsAuthenticated() && _accessor.HttpContext.User.Identity.Name.IsNotEmptyOrNull())
- {
- return _accessor.HttpContext.User.Identity.Name;
- }
- else
- {
- var token = GetToken();
- if (!string.IsNullOrEmpty(token))
- {
- var getNameType = Permissions.IsUseIds4
- ? "name"
- : "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name";
- return GetUserInfoFromToken(getNameType, token).FirstOrDefault().ObjToString();
- }
- }
-
- return "";
- }
-
- public int ID => GetClaimValueByType("jti").FirstOrDefault().ObjToInt();
- public long TenantId => GetClaimValueByType("TenantId").FirstOrDefault().ObjToLong();
-
- public bool IsAuthenticated()
- {
- return _accessor.HttpContext?.User?.Identity?.IsAuthenticated ?? false;
- }
-
-
- public string GetToken()
- {
- var token = _accessor.HttpContext?.Request?.Headers["Authorization"].ObjToString().Replace("Bearer ", "");
- if (!token.IsNullOrEmpty())
- return token;
-
- //var request = _accessor.HttpContext?.Request;
- //if (request != null && request?.Body != null)
- //{
- // var sr = new StreamReader(request?.Body);
- // var BodyData = sr.ReadToEnd();
- // var jsonParam = JsonConvert.DeserializeObject(BodyData);
-
- // if (jsonParam != null && !jsonParam.token.IsNullOrEmpty())
- // {
- // if (_accessor.HttpContext?.Request?.Headers.Any(x => x.Key == "Authorization") == true)
- // _accessor.HttpContext.Request.Headers["Authorization"] = jsonParam.token;
- // else
- // _accessor.HttpContext.Request.Headers.Add("Authorization", "Bearer " + jsonParam.token);
- // return jsonParam.token;
- // }
- //}
-
- if (_accessor.HttpContext?.IsSuccessSwagger() == true)
- {
- token = _accessor.HttpContext.GetSuccessSwaggerJwt();
- if (token.IsNotEmptyOrNull())
- {
- if (_accessor.HttpContext.User.Claims.Any(s => s.Type == JwtRegisteredClaimNames.Jti))
- return token;
-
- var claims = new ClaimsIdentity(GetClaimsIdentity(token));
- _accessor.HttpContext.User.AddIdentity(claims);
- return token;
- }
- }
-
- return token;
- }
-
- public List GetUserInfoFromToken(string ClaimType, string token)
- {
- var jwtHandler = new JwtSecurityTokenHandler();
-
- // token校验
- if (token.IsNotEmptyOrNull() && jwtHandler.CanReadToken(token))
- {
- JwtSecurityToken jwtToken = jwtHandler.ReadJwtToken(token);
-
- return (from item in jwtToken.Claims
- where item.Type == ClaimType
- select item.Value).ToList();
- }
-
- return new List() { };
- }
-
- public ServiceResult MessageModel { get; set; }
-
- public IEnumerable GetClaimsIdentity()
- {
- if (_accessor.HttpContext == null) return ArraySegment.Empty;
-
- if (!IsAuthenticated()) return GetClaimsIdentity(GetToken());
-
- var claims = _accessor.HttpContext.User.Claims.ToList();
- var headers = _accessor.HttpContext.Request.Headers;
- foreach (var header in headers)
- {
- claims.Add(new Claim(header.Key, header.Value));
- }
-
- return claims;
- }
-
- public IEnumerable GetClaimsIdentity(string token)
- {
- var jwtHandler = new JwtSecurityTokenHandler();
- // token校验
- if (token.IsNotEmptyOrNull() && jwtHandler.CanReadToken(token))
- {
- var jwtToken = jwtHandler.ReadJwtToken(token);
-
- return jwtToken.Claims;
- }
-
- return new List();
- }
-
- public List GetClaimValueByType(string ClaimType)
- {
- return (from item in GetClaimsIdentity()
- where item.Type == ClaimType
- select item.Value).ToList();
- }
-
- public string StaffNo => GetStaffNo();
-
- private string GetStaffNo()
- {
- return GetClaimValueByType("StaffNo").FirstOrDefault(); ;
- }
-
- public string StaffName => GetStaffName();
-
- private string GetStaffName()
- {
- return GetClaimValueByType("StaffName").FirstOrDefault();
- }
- public int StaffId => GetStaffId();
-
- private int GetStaffId()
- {
- return GetClaimValueByType("StaffId").FirstOrDefault().ObjToInt();
- }
-
- public int? GetLangId()
- {
- var langId = _accessor.HttpContext?.Request?.Headers["Langid"].ObjToInt();
- if (langId.IsNullOrEmpty())
- return 1;
-
- return langId;
- }
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/HttpContextUser/IUser.cs b/Tiobon.Core.Common/HttpContextUser/IUser.cs
deleted file mode 100644
index 76df174f..00000000
--- a/Tiobon.Core.Common/HttpContextUser/IUser.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System.Security.Claims;
-using Tiobon.Core.Model.Entity;
-
-namespace Tiobon.Core.Common.HttpContextUser;
-
-public interface IUser
-{
- string Name { get; }
- int ID { get; }
- long TenantId { get; }
- bool IsAuthenticated();
- int StaffId { get; }
-
- string StaffName { get; }
-
- string StaffNo { get; }
-
- IEnumerable GetClaimsIdentity();
- List GetClaimValueByType(string ClaimType);
-
- string GetToken();
- List GetUserInfoFromToken(string ClaimType, string token);
-
- ServiceResult MessageModel { get; set; }
- int? GetLangId();
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/Option/Core/ConfigurableOptions.cs b/Tiobon.Core.Common/Option/Core/ConfigurableOptions.cs
deleted file mode 100644
index f52b4279..00000000
--- a/Tiobon.Core.Common/Option/Core/ConfigurableOptions.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.Options;
-
-namespace Tiobon.Core.Common.Option.Core;
-
-public static class ConfigurableOptions
-{
- /// 添加选项配置
- /// 选项类型
- /// 服务集合
- /// 服务集合
- public static IServiceCollection AddConfigurableOptions(this IServiceCollection services)
- where TOptions : class, IConfigurableOptions
- {
- Type optionsType = typeof(TOptions);
- string path = GetConfigurationPath(optionsType);
- services.Configure(App.Configuration.GetSection(path));
-
- return services;
- }
-
- public static IServiceCollection AddConfigurableOptions(this IServiceCollection services, Type type)
- {
- string path = GetConfigurationPath(type);
- var config = App.Configuration.GetSection(path);
-
- Type iOptionsChangeTokenSource = typeof(IOptionsChangeTokenSource<>);
- Type iConfigureOptions = typeof(IConfigureOptions<>);
- Type configurationChangeTokenSource = typeof(ConfigurationChangeTokenSource<>);
- Type namedConfigureFromConfigurationOptions = typeof(NamedConfigureFromConfigurationOptions<>);
- iOptionsChangeTokenSource = iOptionsChangeTokenSource.MakeGenericType(type);
- iConfigureOptions = iConfigureOptions.MakeGenericType(type);
- configurationChangeTokenSource = configurationChangeTokenSource.MakeGenericType(type);
- namedConfigureFromConfigurationOptions = namedConfigureFromConfigurationOptions.MakeGenericType(type);
-
- services.AddOptions();
- services.AddSingleton(iOptionsChangeTokenSource,
- Activator.CreateInstance(configurationChangeTokenSource, Options.DefaultName, config) ?? throw new InvalidOperationException());
- return services.AddSingleton(iConfigureOptions,
- Activator.CreateInstance(namedConfigureFromConfigurationOptions, Options.DefaultName, config) ?? throw new InvalidOperationException());
- }
-
- /// 获取配置路径
- /// 选项类型
- ///
- public static string GetConfigurationPath(Type optionsType)
- {
- var endPath = new[] {"Option", "Options"};
- var configurationPath = optionsType.Name;
- foreach (var s in endPath)
- {
- if (configurationPath.EndsWith(s))
- {
- return configurationPath[..^s.Length];
- }
- }
-
- return configurationPath;
- }
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/Option/Core/IConfigurableOptions.cs b/Tiobon.Core.Common/Option/Core/IConfigurableOptions.cs
deleted file mode 100644
index 7068c7e0..00000000
--- a/Tiobon.Core.Common/Option/Core/IConfigurableOptions.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace Tiobon.Core.Common.Option.Core;
-
-///
-/// 应用选项依赖接口
-/// 自动注入配置文件
-/// 文件名为Option或Options结尾
-///
-public interface IConfigurableOptions
-{
-
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/Option/RedisOptions.cs b/Tiobon.Core.Common/Option/RedisOptions.cs
deleted file mode 100644
index 44e5c4e7..00000000
--- a/Tiobon.Core.Common/Option/RedisOptions.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using Tiobon.Core.Common.Option.Core;
-
-namespace Tiobon.Core.Common.Option;
-
-///
-/// 缓存配置选项
-///
-public sealed class RedisOptions : IConfigurableOptions
-{
- ///
- /// 是否启用
- ///
- public bool Enable { get; set; }
-
- ///
- /// Redis连接
- ///
- public string ConnectionString { get; set; }
-
- ///
- /// 键值前缀
- ///
- public string InstanceName { get; set; }
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/Option/SeqOptions.cs b/Tiobon.Core.Common/Option/SeqOptions.cs
deleted file mode 100644
index 56872d63..00000000
--- a/Tiobon.Core.Common/Option/SeqOptions.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-using Tiobon.Core.Common.Option.Core;
-
-namespace Tiobon.Core.Common.Option;
-
-public class SeqOptions : IConfigurableOptions
-{
- ///
- /// 是否启用
- ///
- public bool Enabled { get; set; }
-
- ///
- /// 地址
- ///
- public string Address { get; set; }
-
- public string ApiKey { get; set; }
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/Swagger/SwaggerContextExtension.cs b/Tiobon.Core.Common/Swagger/SwaggerContextExtension.cs
deleted file mode 100644
index cab576bb..00000000
--- a/Tiobon.Core.Common/Swagger/SwaggerContextExtension.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-using Tiobon.Core.Common.Extensions;
-using Microsoft.AspNetCore.Http;
-using Microsoft.AspNetCore.Http.Extensions;
-
-namespace Tiobon.Core.Common.Swagger;
-
-public static class SwaggerContextExtension
-{
- public const string SwaggerCodeKey = "swagger-code";
- public const string SwaggerJwt = "swagger-jwt";
-
- public static bool IsSuccessSwagger()
- {
- return App.HttpContext?.GetSession()?.GetString(SwaggerCodeKey) == "success";
- }
-
- public static bool IsSuccessSwagger(this HttpContext context)
- {
- return context.GetSession()?.GetString(SwaggerCodeKey) == "success";
- }
-
- public static void SuccessSwagger()
- {
- App.HttpContext?.GetSession()?.SetString(SwaggerCodeKey, "success");
- }
-
- public static void SuccessSwagger(this HttpContext context)
- {
- context.GetSession()?.SetString(SwaggerCodeKey, "success");
- }
-
- public static void SuccessSwaggerJwt(this HttpContext context, string token)
- {
- context.GetSession()?.SetString(SwaggerJwt, token);
- }
-
- public static string GetSuccessSwaggerJwt(this HttpContext context)
- {
- return context.GetSession()?.GetString(SwaggerJwt);
- }
-
-
- public static void RedirectSwaggerLogin(this HttpContext context, bool IsDevelopment)
- {
- var returnUrl = context.Request.GetDisplayUrl(); //获取当前url地址
- if (IsDevelopment)
- context.Response.Redirect("/swg-login.html?returnUrl=" + returnUrl);
- else
- context.Response.Redirect("/Advanced/swg-login.html?returnUrl=" + returnUrl);
- }
-}
\ No newline at end of file
diff --git a/Tiobon.Core.Common/Tiobon.Core.Common.csproj b/Tiobon.Core.Common/Tiobon.Core.Common.csproj
index 8e09f7a7..bc256098 100644
--- a/Tiobon.Core.Common/Tiobon.Core.Common.csproj
+++ b/Tiobon.Core.Common/Tiobon.Core.Common.csproj
@@ -56,7 +56,6 @@
-
diff --git a/Tiobon.Core.EventBus/Tiobon.Core.EventBus.csproj b/Tiobon.Core.EventBus/Tiobon.Core.EventBus.csproj
index 664b0922..e18f924a 100644
--- a/Tiobon.Core.EventBus/Tiobon.Core.EventBus.csproj
+++ b/Tiobon.Core.EventBus/Tiobon.Core.EventBus.csproj
@@ -21,4 +21,11 @@
+
+
+
+ ..\Lib\Tiobon.Core.dll
+
+
+
diff --git a/Tiobon.Core.Extensions/Authorizations/Behaviors/UserBehaviorService.cs b/Tiobon.Core.Extensions/Authorizations/Behaviors/UserBehaviorService.cs
index 7a5dd5ef..ea3b6a31 100644
--- a/Tiobon.Core.Extensions/Authorizations/Behaviors/UserBehaviorService.cs
+++ b/Tiobon.Core.Extensions/Authorizations/Behaviors/UserBehaviorService.cs
@@ -1,5 +1,5 @@
using Microsoft.Extensions.Logging;
-using Tiobon.Core.Common.HttpContextUser;
+using Tiobon.Core.HttpContextUser;
using Tiobon.Core.IServices;
namespace Tiobon.Core.Extensions.Authorizations.Behaviors;
diff --git a/Tiobon.Core.Extensions/Authorizations/Policys/ApiResponseHandler.cs b/Tiobon.Core.Extensions/Authorizations/Policys/ApiResponseHandler.cs
index fa6af0a9..bbbfa552 100644
--- a/Tiobon.Core.Extensions/Authorizations/Policys/ApiResponseHandler.cs
+++ b/Tiobon.Core.Extensions/Authorizations/Policys/ApiResponseHandler.cs
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Newtonsoft.Json;
-using Tiobon.Core.Common.HttpContextUser;
+using Tiobon.Core.HttpContextUser;
using Tiobon.Core.Model;
namespace Tiobon.Core.AuthHelper;
diff --git a/Tiobon.Core.Extensions/Authorizations/Policys/PermissionHandler.cs b/Tiobon.Core.Extensions/Authorizations/Policys/PermissionHandler.cs
index 96f7e0af..6d552db8 100644
--- a/Tiobon.Core.Extensions/Authorizations/Policys/PermissionHandler.cs
+++ b/Tiobon.Core.Extensions/Authorizations/Policys/PermissionHandler.cs
@@ -3,13 +3,12 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using System.Security.Claims;
-using Tiobon.Core.Common;
-using Tiobon.Core.Common.HttpContextUser;
-using Tiobon.Core.Common.Swagger;
using Tiobon.Core.Helper;
+using Tiobon.Core.HttpContextUser;
using Tiobon.Core.IServices;
using Tiobon.Core.Model;
using Tiobon.Core.Model.Models;
+using Tiobon.Core.Swagger;
namespace Tiobon.Core.AuthHelper;
diff --git a/Tiobon.Core.Extensions/Middlewares/RecordAccessLogsMiddleware.cs b/Tiobon.Core.Extensions/Middlewares/RecordAccessLogsMiddleware.cs
index 309e4a49..2fb3ca50 100644
--- a/Tiobon.Core.Extensions/Middlewares/RecordAccessLogsMiddleware.cs
+++ b/Tiobon.Core.Extensions/Middlewares/RecordAccessLogsMiddleware.cs
@@ -5,9 +5,8 @@ using Newtonsoft.Json;
using System.Diagnostics;
using System.Text;
using System.Web;
-using Tiobon.Core.Common;
-using Tiobon.Core.Common.HttpContextUser;
using Tiobon.Core.Common.LogHelper;
+using Tiobon.Core.HttpContextUser;
using Tiobon.Core.Model;
namespace Tiobon.Core.Extensions.Middlewares;
diff --git a/Tiobon.Core.Extensions/Middlewares/SwaggerAuthMiddleware.cs b/Tiobon.Core.Extensions/Middlewares/SwaggerAuthMiddleware.cs
index fdf1e81b..727cb208 100644
--- a/Tiobon.Core.Extensions/Middlewares/SwaggerAuthMiddleware.cs
+++ b/Tiobon.Core.Extensions/Middlewares/SwaggerAuthMiddleware.cs
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Hosting;
using System.Net;
-using Tiobon.Core.Common.Swagger;
+using Tiobon.Core.Swagger;
namespace Tiobon.Core.Extensions.Middlewares;
diff --git a/Tiobon.Core.Extensions/ServiceExtensions/AllOptionRegister.cs b/Tiobon.Core.Extensions/ServiceExtensions/AllOptionRegister.cs
index 4cb71ade..efaa579a 100644
--- a/Tiobon.Core.Extensions/ServiceExtensions/AllOptionRegister.cs
+++ b/Tiobon.Core.Extensions/ServiceExtensions/AllOptionRegister.cs
@@ -1,6 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
-using Tiobon.Core.Common;
-using Tiobon.Core.Common.Option.Core;
+using Tiobon.Core.Option.Core;
namespace Tiobon.Core.Extensions.ServiceExtensions;
diff --git a/Tiobon.Core.Extensions/ServiceExtensions/CacheSetup.cs b/Tiobon.Core.Extensions/ServiceExtensions/CacheSetup.cs
index b2f3dd95..91717d1f 100644
--- a/Tiobon.Core.Extensions/ServiceExtensions/CacheSetup.cs
+++ b/Tiobon.Core.Extensions/ServiceExtensions/CacheSetup.cs
@@ -1,8 +1,7 @@
using Microsoft.Extensions.DependencyInjection;
using StackExchange.Redis;
-using Tiobon.Core.Common;
using Tiobon.Core.Common.Caches;
-using Tiobon.Core.Common.Option;
+using Tiobon.Core.Option;
namespace Tiobon.Core.Extensions.ServiceExtensions;
diff --git a/Tiobon.Core.Extensions/ServiceExtensions/HttpContextSetup.cs b/Tiobon.Core.Extensions/ServiceExtensions/HttpContextSetup.cs
index 3e66b637..812abe92 100644
--- a/Tiobon.Core.Extensions/ServiceExtensions/HttpContextSetup.cs
+++ b/Tiobon.Core.Extensions/ServiceExtensions/HttpContextSetup.cs
@@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
-using Tiobon.Core.Common.HttpContextUser;
+using Tiobon.Core.HttpContextUser;
namespace Tiobon.Core.Extensions;
diff --git a/Tiobon.Core.Extensions/ServiceExtensions/SerilogSetup.cs b/Tiobon.Core.Extensions/ServiceExtensions/SerilogSetup.cs
index 6746b67e..1e331f57 100644
--- a/Tiobon.Core.Extensions/ServiceExtensions/SerilogSetup.cs
+++ b/Tiobon.Core.Extensions/ServiceExtensions/SerilogSetup.cs
@@ -2,9 +2,8 @@
using Serilog;
using Serilog.Debugging;
using Serilog.Events;
-using Tiobon.Core.Common;
using Tiobon.Core.Common.LogHelper;
-using Tiobon.Core.Common.Option;
+using Tiobon.Core.Option;
using Tiobon.Core.Serilog.Configuration;
using Tiobon.Core.Serilog.Extensions;
diff --git a/Tiobon.Core.Gateway/Controllers/UserController.cs b/Tiobon.Core.Gateway/Controllers/UserController.cs
index 0701ed86..975d7210 100644
--- a/Tiobon.Core.Gateway/Controllers/UserController.cs
+++ b/Tiobon.Core.Gateway/Controllers/UserController.cs
@@ -1,9 +1,6 @@
-using Tiobon.Core.Common.HttpContextUser;
-using Tiobon.Core.Model;
-using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
-using System.Collections.Generic;
-using System.Linq;
+using Tiobon.Core.HttpContextUser;
using Tiobon.Core.Model.Entity;
namespace Tiobon.Core.Gateway.Controllers
diff --git a/Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs b/Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs
index 0b2de7c6..7f747d44 100644
--- a/Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs
+++ b/Tiobon.Core.Services/Ghre/Ghre_SurveyServices.cs
@@ -1,5 +1,4 @@
-using MathNet.Numerics.Distributions;
-using System.Text.RegularExpressions;
+using System.Text.RegularExpressions;
namespace Tiobon.Core.Services;
@@ -812,5 +811,21 @@ public class Ghre_SurveyServices : BaseServices QueryRecord(long id)
+// {
+// var sql = @$"SELECT A.Id,
+// A.SurveyClass,
+// A.SurveyName,
+// A.BeginTime,
+// A.EndTime, B.SubmitDate
+//FROM Ghre_Survey A
+// LEFT JOIN Ghre_SurveyRecord B ON A.Id = B.SurveyId AND B.IsEnable = 1 and B.StaffId=9
+//WHERE A.IsEnable = 1 AND A.Status ! = 'Temporary'
+// and (9 in (select value from openjson(A.StaffID))
+// or 41 in (select value from openjson(A.deptId)))"
+// return obj;
+// }
}