diff --git a/Tiobon.CodeGenerator/Program.cs b/Tiobon.CodeGenerator/Program.cs new file mode 100644 index 00000000..4c9269d2 --- /dev/null +++ b/Tiobon.CodeGenerator/Program.cs @@ -0,0 +1,96 @@ +using Microsoft.Extensions.DependencyInjection; +using SqlSugar; +using Tiobon.Core.Common; +using Tiobon.Core.Common.DB; +using Tiobon.Core.Common.DB.Dapper.Extensions; +using Tiobon.Core.Common.Seed; +using Tiobon.Core.Extensions; +using Tiobon.Core.Model; + +namespace JianLian.HDIS.CodeGenerator; +class Program +{ + public static MutiDBOperate GetMainConnectionDb() + { + var mainConnetctDb = BaseDBConfig.MutiConnectionString.allDbs.Find(x => x.ConnId == MainDb.CurrentDbConnId); + if (BaseDBConfig.MutiConnectionString.allDbs.Count > 0) + { + if (mainConnetctDb == null) + { + mainConnetctDb = BaseDBConfig.MutiConnectionString.allDbs[0]; + } + } + else + { + throw new Exception("请确保appsettigns.json中配置连接字符串,并设置Enabled为true;"); + } + + return mainConnetctDb; + } + static void Main(string[] args) + { + + var basePath = AppContext.BaseDirectory; + IServiceCollection services = new ServiceCollection(); + services.AddAutoMapperSetup(); + services.AddSimpleDapperSetup(); + + services.AddSingleton(new AppSettings(basePath)); + services.AddScoped(); + services.AddScoped(); + services.AddSqlsugarSetup(); + + //services.AddScoped(o => + //{ + // return new SqlSugar.SqlSugarScope(new SqlSugar.ConnectionConfig() + // { + // ConnectionString = GetMainConnectionDb().Connection, //必填, 数据库连接字符串 + // DbType = (SqlSugar.DbType)GetMainConnectionDb().DbType, //必填, 数据库类型 + // IsAutoCloseConnection = true, //默认false, 时候知道关闭数据库连接, 设置为true无需使用using或者Close操作 + // }); + //}); + var sp = services.BuildServiceProvider(); + Console.WriteLine("请输入表名!"); + string tableName = Console.ReadLine() ?? "SmApiLog"; + + string[] tableNames = new string[1]; + tableNames[0] = tableName; + string ConnID = null; + + + var isMuti = BaseDBConfig.IsMulti; + var data = new ServiceResult() { Success = true, Message = "" }; + if (1 == 1) + { + var _sqlSugarClient = sp.GetService() as SqlSugarScope; + + ConnID = ConnID == null ? MainDb.CurrentDbConnId.ToLower() : ConnID; + _sqlSugarClient?.ChangeDatabase(ConnID.ToLower()); + data.Data += $"Controller层生成:{FrameSeed.CreateControllers(_sqlSugarClient, ConnID, isMuti, tableNames)} || "; + data.Data += $"库{ConnID}-Model层生成:{FrameSeed.CreateModels(_sqlSugarClient, ConnID, isMuti, tableNames)} || "; + //data.response += $"库{ConnID}-IRepositorys层生成:{FrameSeed.CreateIRepositorys(_sqlSugarClient, ConnID, isMuti, tableNames)} || "; + data.Data += $"库{ConnID}-IServices层生成:{FrameSeed.CreateIServices(_sqlSugarClient, ConnID, isMuti, tableNames)} || "; + //data.response += $"库{ConnID}-Repository层生成:{FrameSeed.CreateRepository(_sqlSugarClient, ConnID, isMuti, tableNames)} || "; + data.Data += $"库{ConnID}-Services层生成:{FrameSeed.CreateServices(_sqlSugarClient, ConnID, isMuti, tableNames)} || "; + // 切回主库 + _sqlSugarClient?.ChangeDatabase(MainDb.CurrentDbConnId.ToLower()); + } + else + { + data.Success = false; + data.Message = "当前不处于开发模式,代码生成不可用!"; + } + + // ALL Completed + Console.WriteLine("ALL Completed!"); + Console.ReadKey(); + Thread.Sleep(Timeout.Infinite); + + } + + public static List ToUnderscoreCase(string str) + { + var str1 = string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToLower(); + return str1.Split('_').ToList(); + } +} \ No newline at end of file diff --git a/Tiobon.CodeGenerator/Tiobon.CodeGenerator.csproj b/Tiobon.CodeGenerator/Tiobon.CodeGenerator.csproj new file mode 100644 index 00000000..2454c94b --- /dev/null +++ b/Tiobon.CodeGenerator/Tiobon.CodeGenerator.csproj @@ -0,0 +1,52 @@ + + + + Exe + net8.0 + enable + enable + + + + + + + + + + + + + + + PreserveNewest + true + PreserveNewest + + + PreserveNewest + true + PreserveNewest + + + PreserveNewest + true + PreserveNewest + + + + + + + + + + + + + + + + + + diff --git a/Tiobon.CodeGenerator/appsettings.Development.json b/Tiobon.CodeGenerator/appsettings.Development.json new file mode 100644 index 00000000..8983e0fc --- /dev/null +++ b/Tiobon.CodeGenerator/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/Tiobon.CodeGenerator/appsettings.apollo.json b/Tiobon.CodeGenerator/appsettings.apollo.json new file mode 100644 index 00000000..a89ebf4f --- /dev/null +++ b/Tiobon.CodeGenerator/appsettings.apollo.json @@ -0,0 +1,370 @@ +{ + "urls": "http://*:9291", //web服务端口,如果用IIS部署,把这个去掉 + "Serilog": { + "MinimumLevel": { + "Default": "Debug", + "Override": { + "Microsoft": "Information", + "Microsoft.AspNetCore": "Warning", + "System": "Warning", + "System.Net.Http.HttpClient": "Warning", + "Hangfire": "Information", + "Magicodes": "Warning", + "DotNetCore.CAP": "Information", + "Savorboard.CAP": "Information", + "Quartz": "Information" + } + } + }, + "AllowedHosts": "*", + "Redis": { + "Enable": false, + "ConnectionString": "127.0.0.1:6379", + "InstanceName": "" //前缀 + }, + "RabbitMQ": { + "Enabled": true, + "Connection": "101xxxx57", + "UserName": "xxxx", + "Password": "xxxxx", + "Port": "5672", + "RetryCount": 2 + }, + "Kafka": { + "Enabled": false, + "Servers": "localhost:9092", + "Topic": "EU", + "GroupId": "EU-consumer", + "NumPartitions": 3 //主题分区数量 + }, + "EventBus": { + "Enabled": false, + "SubscriptionClientName": "EU.Core" + }, + "AppSettings": { + "CachingAOP": { + "Enabled": true + }, + "LogToDb": true, + "LogAOP": { + "Enabled": false, + "LogToFile": { + "Enabled": true + }, + "LogToDB": { + "Enabled": true + } + }, + "TranAOP": { + "Enabled": true + }, + "UserAuditAOP": { + "Enabled": false + }, + "SqlAOP": { + "Enabled": true, + "LogToFile": { + "Enabled": true + }, + "LogToDB": { + "Enabled": true + }, + "LogToConsole": { + "Enabled": true + } + }, + "Date": "2018-08-28", + "SeedDBEnabled": false, //只生成表结构 + "SeedDBDataEnabled": false, //生成表,并初始化数据 + "Author": "EU.Core", + "SvcName": "", // /svc/EU + "UseLoadTest": false + }, + + //优化DB配置、不会再区分单库多库 + //MainDb:标识当前项目的主库,所对应的连接字符串的Enabled必须为true + //Log:标识日志库,所对应的连接字符串的Enabled必须为true + //从库只需配置Slaves数组,要求数据库类型一致!,比如都是SqlServer + // + //新增,故障转移方案 + //如果主库挂了,会自动切换到备用连接(比如说主库+备用库) + //备用连接的ConnId配置为主库的ConnId+数字即可,比如主库的ConnId为Main,那么备用连接的ConnId为Mian1 + //主库、备用库无需数据库类型一致! + //备用库不会有程序维护,需要手动维护 + "MainDB": "WMEU_MSSQL_Main", //当前项目的主库,所对应的连接字符串的Enabled必须为true + "DBS": [ + /* + 对应下边的 DBType + MySql = 0, + SqlServer = 1, + Sqlite = 2, + Oracle = 3, + PostgreSQL = 4, + Dm = 5,//达梦 + Kdbndp = 6,//人大金仓 + */ + { + "ConnId": "WMEU_MSSQL_Main", + "DBType": 1, + "Enabled": true, + "Connection": "Data Source=116.204.98.209;User ID=eu_cloud;Password=qazWESDR,!@#288268;Database=EU_Cloud;Encrypt=True;TrustServerCertificate=True;", + "ProviderName": "System.Data.SqlClient" + }, + { + "ConnId": "Main", + "DBType": 2, + "Enabled": false, + "Connection": "WMEU.db", //sqlite只写数据库名就行 + "Slaves": [ + { + "HitRate": 0, // 值越大,优先级越高 0不使用 + "Connection": "WMEU2.db" + } + ] + }, + { + "ConnId": "Main2", + "DBType": 2, + "Enabled": false, + "Connection": "WMEU3.db", //sqlite只写数据库名就行 + "Slaves": [ + { + "HitRate": 0, // 值越大,优先级越高 0不使用 + "Connection": "WMEU4.db" + } + ] + }, + { + "ConnId": "Log", //日志库连接固定名称,不要改,其他的可以改 + "DBType": 1, + "Enabled": true, + "HitRate": 50, + "Connection": "Data Source=116.204.98.209;User ID=EU;Password=&($!4UGUyU#$2sp9O;Database=EU;Encrypt=True;TrustServerCertificate=True;", + "ProviderName": "System.Data.SqlClient" + }, + { + "ConnId": "WMEU_MSSQL_1", + "DBType": 1, + "Enabled": false, + "Connection": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=WMEU_MSSQL_1;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", + "ProviderName": "System.Data.SqlClient" + }, + { + "ConnId": "WMEU_MSSQL_2", + "DBType": 1, + "Enabled": false, + "Connection": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=WMEU_MSSQL_2;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", + "ProviderName": "System.Data.SqlClient" + }, + { + "ConnId": "WMEU_MYSQL", + "DBType": 0, + "Enabled": false, + "Connection": "server=localhost;Database=EU;Uid=root;Pwd=root;Port=3306;Allow User Variables=True;" + }, + { + "ConnId": "WMEU_MYSQL_2", + "DBType": 0, + "Enabled": false, + "Connection": "server=localhost;Database=EUcore001;Uid=root;Pwd=root;Port=3306;Allow User Variables=True;" + }, + { + "ConnId": "WMEU_ORACLE", + "DBType": 3, + "Enabled": false, + "Connection": "Data Source=127.0.0.1/ops;User ID=OPS;Password=123456;Persist Security Info=True;Connection Timeout=60;" + }, + { + "ConnId": "WMEU_DM", + "DBType": 5, + "Enabled": false, + "Connection": "Server=xxxxx:5236;User Id=xxxxx;PWD=xxxxx;SCHEMA=TESTDBA;" + }, + { + "ConnId": "WMEU_KDBNDP", + "DBType": 6, + "Enabled": false, + "Connection": "Server=127.0.0.1;Port=54321;UID=SYSTEM;PWD=system;database=SQLSUGAR4XTEST1;" + } + ], + "Audience": { + "Secret": "sdfsdfsrty45634kkhllghtdgdfss345t678fs", //不要太短,16位+ + "SecretFile": "C:\\my-file\\EU.core.audience.secret.txt", //安全。内容就是Secret + "Issuer": "EU.Core", //这个值一定要在自己的项目里修改!! + "Audience": "wr" //这个值一定要在自己的项目里修改!! + }, + "Mongo": { + "ConnectionString": "mongodb://nosql.data", + "Database": "EUCoreDb" + }, + "Startup": { + "Domain": "http://localhost:9291", + "Cors": { + "PolicyName": "CorsIpAccess", //策略名称 + "EnableAllIPs": false, //当为true时,开放所有IP均可访问。 + // 支持多个域名端口,注意端口号后不要带/斜杆:比如localhost:8000/,是错的 + // 注意,http://127.0.0.1:1818 和 http://localhost:1818 是不一样的 + "IPs": "http://127.0.0.1:2364,http://localhost:2364,http://127.0.0.1:6688,http://localhost:6688" + }, + "AppConfigAlert": { + "Enabled": true + }, + "IdentityServer4": { + "Enabled": false, // 这里默认是false,表示使用jwt,如果设置为true,则表示系统使用Ids4模式 + "AuthorizationUrl": "http://localhost:5004", // 认证中心域名 + "ApiName": "EU.core.api" // 资源服务器 + }, + "Authing": { + "Enabled": false, + "Issuer": "https://uldr24esx31h-demo.authing.cn/oidc", + "Audience": "63d51c4205c2849803be5178", + "JwksUri": "https://uldr24esx31h-demo.authing.cn/oidc/.well-known/jwks.json" + }, + "RedisMq": { + "Enabled": false //redis 消息队列 + }, + "MiniProfiler": { + "Enabled": false //性能分析开启 + }, + "Nacos": { + "Enabled": false //Nacos注册中心 + } + }, + "Middleware": { + "RequestResponseLog": { + "Enabled": true, + "LogToFile": { + "Enabled": true + }, + "LogToDB": { + "Enabled": true + } + }, + "IPLog": { + "Enabled": true, + "LogToFile": { + "Enabled": true + }, + "LogToDB": { + "Enabled": true + } + }, + "RecordAccessLogs": { + "Enabled": true, + "LogToFile": { + "Enabled": true + }, + "LogToDB": { + "Enabled": true + }, + "IgnoreApis": "/api/permission/getnavigationbar,/api/monitor/getids4users,/api/monitor/getaccesslogs,/api/monitor/server,/api/monitor/getactiveusers,/api/monitor/server," + }, + "SignalR": { + "Enabled": false + }, + "SignalRSendLog": { + "Enabled": false + }, + "QuartzNetJob": { + "Enabled": false + }, + "Consul": { + "Enabled": false + }, + "IpRateLimit": { + "Enabled": false + }, + "EncryptionResponse": { + "Enabled": true, + "AllApis": false, + "LimitApis": [ + "/api/Login/GetJwtTokenSecret" + ] + }, + "EncryptionRequest": { + "Enabled": true, + "AllApis": false, + "LimitApis": [ + "/api/Login/GetJwtTokenSecret" + ] + } + }, + "IpRateLimiting": { + "EnableEndpointRateLimiting": false, //False: globally executed, true: executed for each + "StackBlockedRequests": false, //False: Number of rejections should be recorded on another counter + "RealIpHeader": "X-Real-IP", + "ClientIdHeader": "X-ClientId", + "IpWhitelist": [], //白名单 + "EndpointWhitelist": [ "get:/api/xxx", "*:/api/yyy" ], + "ClientWhitelist": [ "dev-client-1", "dev-client-2" ], + "QuotaExceededResponse": { + "Content": "{{\"status\":429,\"msg\":\"访问过于频繁,请稍后重试\",\"success\":false}}", + "ContentType": "application/json", + "StatusCode": 429 + }, + "HttpStatusCode": 429, //返回状态码 + "GeneralRules": [ //api规则,结尾一定要带* + { + "Endpoint": "*:/api/EU*", + "Period": "1m", + "Limit": 20 + }, + { + "Endpoint": "*/api/*", + "Period": "1s", + "Limit": 3 + }, + { + "Endpoint": "*/api/*", + "Period": "1m", + "Limit": 30 + }, + { + "Endpoint": "*/api/*", + "Period": "12h", + "Limit": 500 + } + ] + + }, + "ConsulSetting": { + "ServiceName": "EUCoreService", + "ServiceIP": "localhost", + "ServicePort": "9291", + "ServiceHealthCheck": "/healthcheck", + "ConsulAddress": "http://localhost:8500" + }, + "PayInfo": { //建行聚合支付信息 + "MERCHANTID": "", //商户号 + "POSID": "", //柜台号 + "BRANCHID": "", //分行号 + "pubKey": "", //公钥 + "USER_ID": "", //操作员号 + "PASSWORD": "", //密码 + "OutAddress": "http://127.0.0.1:12345" //外联地址 + }, + "nacos": { + "ServerAddresses": [ "http://localhost:8848" ], // nacos 连接地址 + "DefaultTimeOut": 15000, // 默认超时时间 + "Namespace": "public", // 命名空间 + "ListenInterval": 10000, // 监听的频率 + "ServiceName": "EU.Core.Api", // 服务名 + "Port": "9291", // 服务端口号 + "RegisterEnabled": true // 是否直接注册nacos + }, + "LogFiedOutPutConfigs": { + "tcpAddressHost": "", // 输出elk的tcp连接地址 + "tcpAddressPort": 0, // 输出elk的tcp端口号 + "ConfigsInfo": [ // 配置的输出elk节点内容 常用语动态标识 + { + "FiedName": "applicationName", + "FiedValue": "EU.Core.Api" + } + ] + }, + "Seq": { + "Enabled": true, + "Address": "http://localhost:5341/", + "ApiKey": "" + } +} \ No newline at end of file diff --git a/Tiobon.CodeGenerator/appsettings.json b/Tiobon.CodeGenerator/appsettings.json new file mode 100644 index 00000000..a89ebf4f --- /dev/null +++ b/Tiobon.CodeGenerator/appsettings.json @@ -0,0 +1,370 @@ +{ + "urls": "http://*:9291", //web服务端口,如果用IIS部署,把这个去掉 + "Serilog": { + "MinimumLevel": { + "Default": "Debug", + "Override": { + "Microsoft": "Information", + "Microsoft.AspNetCore": "Warning", + "System": "Warning", + "System.Net.Http.HttpClient": "Warning", + "Hangfire": "Information", + "Magicodes": "Warning", + "DotNetCore.CAP": "Information", + "Savorboard.CAP": "Information", + "Quartz": "Information" + } + } + }, + "AllowedHosts": "*", + "Redis": { + "Enable": false, + "ConnectionString": "127.0.0.1:6379", + "InstanceName": "" //前缀 + }, + "RabbitMQ": { + "Enabled": true, + "Connection": "101xxxx57", + "UserName": "xxxx", + "Password": "xxxxx", + "Port": "5672", + "RetryCount": 2 + }, + "Kafka": { + "Enabled": false, + "Servers": "localhost:9092", + "Topic": "EU", + "GroupId": "EU-consumer", + "NumPartitions": 3 //主题分区数量 + }, + "EventBus": { + "Enabled": false, + "SubscriptionClientName": "EU.Core" + }, + "AppSettings": { + "CachingAOP": { + "Enabled": true + }, + "LogToDb": true, + "LogAOP": { + "Enabled": false, + "LogToFile": { + "Enabled": true + }, + "LogToDB": { + "Enabled": true + } + }, + "TranAOP": { + "Enabled": true + }, + "UserAuditAOP": { + "Enabled": false + }, + "SqlAOP": { + "Enabled": true, + "LogToFile": { + "Enabled": true + }, + "LogToDB": { + "Enabled": true + }, + "LogToConsole": { + "Enabled": true + } + }, + "Date": "2018-08-28", + "SeedDBEnabled": false, //只生成表结构 + "SeedDBDataEnabled": false, //生成表,并初始化数据 + "Author": "EU.Core", + "SvcName": "", // /svc/EU + "UseLoadTest": false + }, + + //优化DB配置、不会再区分单库多库 + //MainDb:标识当前项目的主库,所对应的连接字符串的Enabled必须为true + //Log:标识日志库,所对应的连接字符串的Enabled必须为true + //从库只需配置Slaves数组,要求数据库类型一致!,比如都是SqlServer + // + //新增,故障转移方案 + //如果主库挂了,会自动切换到备用连接(比如说主库+备用库) + //备用连接的ConnId配置为主库的ConnId+数字即可,比如主库的ConnId为Main,那么备用连接的ConnId为Mian1 + //主库、备用库无需数据库类型一致! + //备用库不会有程序维护,需要手动维护 + "MainDB": "WMEU_MSSQL_Main", //当前项目的主库,所对应的连接字符串的Enabled必须为true + "DBS": [ + /* + 对应下边的 DBType + MySql = 0, + SqlServer = 1, + Sqlite = 2, + Oracle = 3, + PostgreSQL = 4, + Dm = 5,//达梦 + Kdbndp = 6,//人大金仓 + */ + { + "ConnId": "WMEU_MSSQL_Main", + "DBType": 1, + "Enabled": true, + "Connection": "Data Source=116.204.98.209;User ID=eu_cloud;Password=qazWESDR,!@#288268;Database=EU_Cloud;Encrypt=True;TrustServerCertificate=True;", + "ProviderName": "System.Data.SqlClient" + }, + { + "ConnId": "Main", + "DBType": 2, + "Enabled": false, + "Connection": "WMEU.db", //sqlite只写数据库名就行 + "Slaves": [ + { + "HitRate": 0, // 值越大,优先级越高 0不使用 + "Connection": "WMEU2.db" + } + ] + }, + { + "ConnId": "Main2", + "DBType": 2, + "Enabled": false, + "Connection": "WMEU3.db", //sqlite只写数据库名就行 + "Slaves": [ + { + "HitRate": 0, // 值越大,优先级越高 0不使用 + "Connection": "WMEU4.db" + } + ] + }, + { + "ConnId": "Log", //日志库连接固定名称,不要改,其他的可以改 + "DBType": 1, + "Enabled": true, + "HitRate": 50, + "Connection": "Data Source=116.204.98.209;User ID=EU;Password=&($!4UGUyU#$2sp9O;Database=EU;Encrypt=True;TrustServerCertificate=True;", + "ProviderName": "System.Data.SqlClient" + }, + { + "ConnId": "WMEU_MSSQL_1", + "DBType": 1, + "Enabled": false, + "Connection": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=WMEU_MSSQL_1;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", + "ProviderName": "System.Data.SqlClient" + }, + { + "ConnId": "WMEU_MSSQL_2", + "DBType": 1, + "Enabled": false, + "Connection": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=WMEU_MSSQL_2;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", + "ProviderName": "System.Data.SqlClient" + }, + { + "ConnId": "WMEU_MYSQL", + "DBType": 0, + "Enabled": false, + "Connection": "server=localhost;Database=EU;Uid=root;Pwd=root;Port=3306;Allow User Variables=True;" + }, + { + "ConnId": "WMEU_MYSQL_2", + "DBType": 0, + "Enabled": false, + "Connection": "server=localhost;Database=EUcore001;Uid=root;Pwd=root;Port=3306;Allow User Variables=True;" + }, + { + "ConnId": "WMEU_ORACLE", + "DBType": 3, + "Enabled": false, + "Connection": "Data Source=127.0.0.1/ops;User ID=OPS;Password=123456;Persist Security Info=True;Connection Timeout=60;" + }, + { + "ConnId": "WMEU_DM", + "DBType": 5, + "Enabled": false, + "Connection": "Server=xxxxx:5236;User Id=xxxxx;PWD=xxxxx;SCHEMA=TESTDBA;" + }, + { + "ConnId": "WMEU_KDBNDP", + "DBType": 6, + "Enabled": false, + "Connection": "Server=127.0.0.1;Port=54321;UID=SYSTEM;PWD=system;database=SQLSUGAR4XTEST1;" + } + ], + "Audience": { + "Secret": "sdfsdfsrty45634kkhllghtdgdfss345t678fs", //不要太短,16位+ + "SecretFile": "C:\\my-file\\EU.core.audience.secret.txt", //安全。内容就是Secret + "Issuer": "EU.Core", //这个值一定要在自己的项目里修改!! + "Audience": "wr" //这个值一定要在自己的项目里修改!! + }, + "Mongo": { + "ConnectionString": "mongodb://nosql.data", + "Database": "EUCoreDb" + }, + "Startup": { + "Domain": "http://localhost:9291", + "Cors": { + "PolicyName": "CorsIpAccess", //策略名称 + "EnableAllIPs": false, //当为true时,开放所有IP均可访问。 + // 支持多个域名端口,注意端口号后不要带/斜杆:比如localhost:8000/,是错的 + // 注意,http://127.0.0.1:1818 和 http://localhost:1818 是不一样的 + "IPs": "http://127.0.0.1:2364,http://localhost:2364,http://127.0.0.1:6688,http://localhost:6688" + }, + "AppConfigAlert": { + "Enabled": true + }, + "IdentityServer4": { + "Enabled": false, // 这里默认是false,表示使用jwt,如果设置为true,则表示系统使用Ids4模式 + "AuthorizationUrl": "http://localhost:5004", // 认证中心域名 + "ApiName": "EU.core.api" // 资源服务器 + }, + "Authing": { + "Enabled": false, + "Issuer": "https://uldr24esx31h-demo.authing.cn/oidc", + "Audience": "63d51c4205c2849803be5178", + "JwksUri": "https://uldr24esx31h-demo.authing.cn/oidc/.well-known/jwks.json" + }, + "RedisMq": { + "Enabled": false //redis 消息队列 + }, + "MiniProfiler": { + "Enabled": false //性能分析开启 + }, + "Nacos": { + "Enabled": false //Nacos注册中心 + } + }, + "Middleware": { + "RequestResponseLog": { + "Enabled": true, + "LogToFile": { + "Enabled": true + }, + "LogToDB": { + "Enabled": true + } + }, + "IPLog": { + "Enabled": true, + "LogToFile": { + "Enabled": true + }, + "LogToDB": { + "Enabled": true + } + }, + "RecordAccessLogs": { + "Enabled": true, + "LogToFile": { + "Enabled": true + }, + "LogToDB": { + "Enabled": true + }, + "IgnoreApis": "/api/permission/getnavigationbar,/api/monitor/getids4users,/api/monitor/getaccesslogs,/api/monitor/server,/api/monitor/getactiveusers,/api/monitor/server," + }, + "SignalR": { + "Enabled": false + }, + "SignalRSendLog": { + "Enabled": false + }, + "QuartzNetJob": { + "Enabled": false + }, + "Consul": { + "Enabled": false + }, + "IpRateLimit": { + "Enabled": false + }, + "EncryptionResponse": { + "Enabled": true, + "AllApis": false, + "LimitApis": [ + "/api/Login/GetJwtTokenSecret" + ] + }, + "EncryptionRequest": { + "Enabled": true, + "AllApis": false, + "LimitApis": [ + "/api/Login/GetJwtTokenSecret" + ] + } + }, + "IpRateLimiting": { + "EnableEndpointRateLimiting": false, //False: globally executed, true: executed for each + "StackBlockedRequests": false, //False: Number of rejections should be recorded on another counter + "RealIpHeader": "X-Real-IP", + "ClientIdHeader": "X-ClientId", + "IpWhitelist": [], //白名单 + "EndpointWhitelist": [ "get:/api/xxx", "*:/api/yyy" ], + "ClientWhitelist": [ "dev-client-1", "dev-client-2" ], + "QuotaExceededResponse": { + "Content": "{{\"status\":429,\"msg\":\"访问过于频繁,请稍后重试\",\"success\":false}}", + "ContentType": "application/json", + "StatusCode": 429 + }, + "HttpStatusCode": 429, //返回状态码 + "GeneralRules": [ //api规则,结尾一定要带* + { + "Endpoint": "*:/api/EU*", + "Period": "1m", + "Limit": 20 + }, + { + "Endpoint": "*/api/*", + "Period": "1s", + "Limit": 3 + }, + { + "Endpoint": "*/api/*", + "Period": "1m", + "Limit": 30 + }, + { + "Endpoint": "*/api/*", + "Period": "12h", + "Limit": 500 + } + ] + + }, + "ConsulSetting": { + "ServiceName": "EUCoreService", + "ServiceIP": "localhost", + "ServicePort": "9291", + "ServiceHealthCheck": "/healthcheck", + "ConsulAddress": "http://localhost:8500" + }, + "PayInfo": { //建行聚合支付信息 + "MERCHANTID": "", //商户号 + "POSID": "", //柜台号 + "BRANCHID": "", //分行号 + "pubKey": "", //公钥 + "USER_ID": "", //操作员号 + "PASSWORD": "", //密码 + "OutAddress": "http://127.0.0.1:12345" //外联地址 + }, + "nacos": { + "ServerAddresses": [ "http://localhost:8848" ], // nacos 连接地址 + "DefaultTimeOut": 15000, // 默认超时时间 + "Namespace": "public", // 命名空间 + "ListenInterval": 10000, // 监听的频率 + "ServiceName": "EU.Core.Api", // 服务名 + "Port": "9291", // 服务端口号 + "RegisterEnabled": true // 是否直接注册nacos + }, + "LogFiedOutPutConfigs": { + "tcpAddressHost": "", // 输出elk的tcp连接地址 + "tcpAddressPort": 0, // 输出elk的tcp端口号 + "ConfigsInfo": [ // 配置的输出elk节点内容 常用语动态标识 + { + "FiedName": "applicationName", + "FiedValue": "EU.Core.Api" + } + ] + }, + "Seq": { + "Enabled": true, + "Address": "http://localhost:5341/", + "ApiKey": "" + } +} \ No newline at end of file diff --git a/Tiobon.Core.sln b/Tiobon.Core.sln index 57ea08d0..4beb5077 100644 --- a/Tiobon.Core.sln +++ b/Tiobon.Core.sln @@ -62,6 +62,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tiobon.Core.Tests", "Tiobon EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tiobon.Core.DataAccess", "Tiobon.Core.DataAccess\Tiobon.Core.DataAccess.csproj", "{44B3465C-70F2-420F-8B13-50BC264AD0EA}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tiobon.CodeGenerator", "Tiobon.CodeGenerator\Tiobon.CodeGenerator.csproj", "{BA7081E8-08F2-4CC2-ACD9-E878C0CDE313}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -132,6 +134,10 @@ Global {44B3465C-70F2-420F-8B13-50BC264AD0EA}.Debug|Any CPU.Build.0 = Debug|Any CPU {44B3465C-70F2-420F-8B13-50BC264AD0EA}.Release|Any CPU.ActiveCfg = Release|Any CPU {44B3465C-70F2-420F-8B13-50BC264AD0EA}.Release|Any CPU.Build.0 = Release|Any CPU + {BA7081E8-08F2-4CC2-ACD9-E878C0CDE313}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BA7081E8-08F2-4CC2-ACD9-E878C0CDE313}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BA7081E8-08F2-4CC2-ACD9-E878C0CDE313}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BA7081E8-08F2-4CC2-ACD9-E878C0CDE313}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE