diff --git a/Entity/Api/Req/AddChargeOrderReq.cs b/Entity/Api/Req/AddChargeOrderReq.cs index 9883143..4815bb6 100644 --- a/Entity/Api/Req/AddChargeOrderReq.cs +++ b/Entity/Api/Req/AddChargeOrderReq.cs @@ -234,7 +234,7 @@ public partial class AddChargeOrderReq /// /// 云平台充电订单 /// - public string? CloudSn { get; set; } + public string? CloudChargeOrder { get; set; } } diff --git a/Entity/Api/Req/ModifyChargeOrderReq.cs b/Entity/Api/Req/ModifyChargeOrderReq.cs index 0e4bb90..6b97588 100644 --- a/Entity/Api/Req/ModifyChargeOrderReq.cs +++ b/Entity/Api/Req/ModifyChargeOrderReq.cs @@ -246,7 +246,7 @@ namespace Entity.Api.Req /// /// 云平台充电订单 /// - public string? CloudSn { get; set; } + public string? CloudChargeOrder { get; set; } } diff --git a/Entity/Api/Req/QueryChargeOrderReq.cs b/Entity/Api/Req/QueryChargeOrderReq.cs index 7fbc2cd..423bad9 100644 --- a/Entity/Api/Req/QueryChargeOrderReq.cs +++ b/Entity/Api/Req/QueryChargeOrderReq.cs @@ -116,8 +116,15 @@ namespace Entity.Api.Req /// /// 云平台充电订单 /// - public string? CloudSn { get; set; } + public string? CloudChargeOrder { get; set; } + /// + /// Desc:是否可以上传云平台 + /// Default: + /// Nullable:True + /// + [SugarColumn(ColumnName = "can_upload")] + public int? CanUpload { get; set; } } } diff --git a/Entity/Api/Resp/ChargeOrderResp.cs b/Entity/Api/Resp/ChargeOrderResp.cs index c424ee0..8689341 100644 --- a/Entity/Api/Resp/ChargeOrderResp.cs +++ b/Entity/Api/Resp/ChargeOrderResp.cs @@ -245,8 +245,13 @@ namespace Entity.Api.Resp /// /// 云平台充电订单 /// - public string? CloudSn { get; set; } - + public string? CloudChargeOrder { get; set; } + /// + /// Desc:是否可以上传云平台 + /// Default: + /// Nullable:True + /// + public int? CanUpload { get; set; } } } diff --git a/Entity/DbModel/Station/ChargeOrder.cs b/Entity/DbModel/Station/ChargeOrder.cs index 339c531..c9f30b7 100644 --- a/Entity/DbModel/Station/ChargeOrder.cs +++ b/Entity/DbModel/Station/ChargeOrder.cs @@ -290,12 +290,6 @@ namespace Entity.DbModel.Station [SugarColumn(ColumnName = "updated_time")] public DateTime? UpdatedTime { get; set; } - /// - /// 云平台充电订单 - /// - [SugarColumn(ColumnName = "cloud_sn")] - public string? CloudSn { get; set; } - /// /// Desc:云平台订单编号 /// Default: diff --git a/HybirdFrameworkCore/Autofac/AutofacModuleRegister.cs b/HybirdFrameworkCore/Autofac/AutofacModuleRegister.cs index 9510427..b47c643 100644 --- a/HybirdFrameworkCore/Autofac/AutofacModuleRegister.cs +++ b/HybirdFrameworkCore/Autofac/AutofacModuleRegister.cs @@ -50,17 +50,14 @@ public class AutofacModuleRegister : Module { if (ScopeConst.InstancePerLifetimeScope == scope.Scope) { - Log.Debug($"register InstancePerLifetimeScope {type}"); instancePerLifetimeScopeList.Add(type); } else if (ScopeConst.InstancePerDependency == scope.Scope) { - Log.Debug($"register InstancePerDependency {type}"); instancePerDependencyList.Add(type); } else { - Log.Debug($"register SingleInstance {type}"); defaultList.Add(type); } } diff --git a/HybirdFrameworkCore/Configuration/AppSettingsHelper.cs b/HybirdFrameworkCore/Configuration/AppSettingsHelper.cs index b0d1d8a..118423a 100644 --- a/HybirdFrameworkCore/Configuration/AppSettingsHelper.cs +++ b/HybirdFrameworkCore/Configuration/AppSettingsHelper.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.Configuration; +using log4net; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration.Json; using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -10,11 +11,8 @@ namespace HybirdFrameworkCore.Configuration; /// public class AppSettingsHelper { - public AppSettingsHelper(string contentPath) - { - } - - private static IConfiguration Configuration { get; set; } + private static readonly ILog Log = LogManager.GetLogger(typeof(AppSettingsHelper)); + private static IConfiguration? Configuration { get; set; } /// /// 封装要操作的字符 @@ -22,21 +20,35 @@ public class AppSettingsHelper /// /// 节点配置 /// - public static string GetContent(params string[] sections) + public static string? GetContent(params string[] sections) { try { - var contentPath = AppDomain.CurrentDomain.BaseDirectory; - var Path = "appsettings.json"; - Configuration = new ConfigurationBuilder().SetBasePath(contentPath).Add(new JsonConfigurationSource - { Path = Path, Optional = false, ReloadOnChange = true }).Build(); + if (Configuration == null) + { + string? activeProfile = Environment.GetEnvironmentVariable("profiles_active"); + if (activeProfile == null) + { + activeProfile = ""; + } + else + { + activeProfile += "."; + } + var path = "appsettings."+ activeProfile+ "json"; + Log.Info($"read path={path}"); + var contentPath = AppDomain.CurrentDomain.BaseDirectory; + Configuration = new ConfigurationBuilder().SetBasePath(contentPath).Add(new JsonConfigurationSource + { Path = path, Optional = false, ReloadOnChange = true }).Build(); + } + if (sections.Any()) return Configuration[string.Join(":", sections)]; } catch (Exception) { } - return ""; + return null; } public static bool SetContent(string value, params string[] sections) @@ -44,9 +56,18 @@ public class AppSettingsHelper try { var contentPath = AppDomain.CurrentDomain.BaseDirectory; - var Path = contentPath + "appsettings.json"; + string? activeProfile = Environment.GetEnvironmentVariable("profiles_active"); + if (activeProfile == null) + { + activeProfile = ""; + } + else + { + activeProfile += "."; + } + var path = "appsettings."+ activeProfile+ "json"; JObject jsonObject; - using (var file = new StreamReader(Path)) + using (var file = new StreamReader(path)) using (var reader = new JsonTextReader(file)) { jsonObject = (JObject)JToken.ReadFrom(reader); @@ -54,7 +75,7 @@ public class AppSettingsHelper jsonObject[sections[0]][sections[1]] = value; } - using (var writer = new StreamWriter(Path)) + using (var writer = new StreamWriter(path)) using (var jsonwriter = new JsonTextWriter(writer)) { jsonObject.WriteTo(jsonwriter); @@ -67,4 +88,24 @@ public class AppSettingsHelper return true; } + + /// + /// + /// + /// + /// + public static bool GetBool(params string[] sections) + { + string s = GetContent(sections); + if (string.IsNullOrWhiteSpace(s)) + { + return false; + } + if (bool.TryParse(s, out var result)) + { + return result; + } + + return false; + } } \ No newline at end of file diff --git a/Service/Execute/StationSoftMgr.cs b/Service/Execute/StationSoftMgr.cs index acf84fe..f3464e5 100644 --- a/Service/Execute/StationSoftMgr.cs +++ b/Service/Execute/StationSoftMgr.cs @@ -1,4 +1,6 @@ -using Service.BusinessTask; +using Autofac; +using HybirdFrameworkCore.Autofac; +using Service.BusinessTask; using Service.BusinessTask.MyTask; using Service.Cloud.Client.MyTask; @@ -14,7 +16,7 @@ namespace Service.Execute private static readonly AbstractTaskHandler SwapOrderReportCloudTask = new SwapOrderReportCloudTask(); private static readonly AbstractTaskHandler BatteryMoveTask = new BatteryMoveTask(); - private static readonly AbstractTaskHandler ChargeOrderUploadTask = new ChargeOrderUploadTask(); + private static readonly AbstractTaskHandler ChargeOrderUploadTask = AppInfo.Container.Resolve(); #region Task diff --git a/Service/Station/ChargeOrderService.cs b/Service/Station/ChargeOrderService.cs index 88b45f3..65438d1 100644 --- a/Service/Station/ChargeOrderService.cs +++ b/Service/Station/ChargeOrderService.cs @@ -112,9 +112,9 @@ public class ChargeOrderService : BaseServices Expression> condition2Expr = u => u.CloudReportStatus == chargeOrder.CloudReportStatus; where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); } - if (!string.IsNullOrEmpty(chargeOrder.CloudSn)) + if (!string.IsNullOrEmpty(chargeOrder.CloudChargeOrder)) { - Expression> condition2Expr = u => u.CloudSn == chargeOrder.CloudSn; + Expression> condition2Expr = u => u.CloudChargeOrder == chargeOrder.CloudChargeOrder; where = where == null ? condition2Expr : Expression.Lambda>(Expression.AndAlso(where.Body, condition2Expr.Body), parameter); } #endregion diff --git a/WebStarter/Program.cs b/WebStarter/Program.cs index 55ac4e6..abaf9d5 100644 --- a/WebStarter/Program.cs +++ b/WebStarter/Program.cs @@ -6,17 +6,18 @@ using HybirdFrameworkCore.Autofac; using HybirdFrameworkCore.Configuration; using HybirdFrameworkCore.Entity; using HybirdFrameworkCore.Redis; +using log4net; using Mapster; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.IdentityModel.Tokens; using Service.Cloud.Client; using Service.Execute; -using Service.Execute.StaticTools; using Service.Plc.Client; using SqlSugar; using SqlSugar.IOC; var builder = WebApplication.CreateBuilder(args); +var log = LogManager.GetLogger(typeof(Program)); builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory()); builder.Host.ConfigureContainer(cb => @@ -63,17 +64,12 @@ builder.Services.AddCors(options => ); }); - //redis -var section = builder.Configuration.GetSection("Redis"); -//连接字符串 -var redisConnectionString = section.GetSection("Connection").Value; -//实例名称 -var instanceName = section.GetSection("InstanceName").Value; -//默认数据库 -var _defaultDB = int.Parse(section.GetSection("DefaultDB").Value ?? "0"); +var redisConnectionString = AppSettingsHelper.GetContent("Redis", "Connection"); +var instanceName = AppSettingsHelper.GetContent("Redis", "InstanceName");//默认数据库 +var defaultDb = int.Parse(AppSettingsHelper.GetContent("Redis", "DefaultDB") ?? "0"); if (redisConnectionString != null && instanceName != null) - builder.Services.AddSingleton(new RedisHelper(redisConnectionString, instanceName, _defaultDB)); + builder.Services.AddSingleton(new RedisHelper(redisConnectionString, instanceName, defaultDb)); builder.Services.AddControllers().AddJsonOptions(configure => { @@ -122,12 +118,6 @@ builder.Services.AddAuthentication(options => }; }); -//Json 序列化 -builder.Services.AddControllers().AddJsonOptions(configure => -{ - configure.JsonSerializerOptions.Converters.Add(new DatetimeJsonConverter()); -}); - @@ -136,12 +126,9 @@ var app = builder.Build(); // Configure the HTTP request pipeline. -if (app.Environment.IsDevelopment()) -{ - app.UseSwagger(); - app.UseSwaggerUI(); - app.UseStaticFiles(); -} +app.UseSwagger(); +app.UseSwaggerUI(); +app.UseStaticFiles(); app.UseAuthorization(); app.UseCors("myCors"); @@ -150,6 +137,7 @@ app.MapControllers(); var list = AppSettingsHelper.GetContent("Kestrel", "Endpoints", "http", "Url"); foreach (var s in list.Split(";")) { + log.Info($"use url={s}"); app.Urls.Add(s); } @@ -157,10 +145,28 @@ foreach (var s in list.Split(";")) AppInfo.Container = app.Services.GetAutofacRoot(); //云平台 -CloudClientMgr.Init(); +if (AppSettingsHelper.GetBool("cloud", "enable")) +{ + CloudClientMgr.Init(); +} + //PLC -PlcMgr.Init(); +if (AppSettingsHelper.GetBool("plc", "enable")) +{ + PlcMgr.Init(); +} + //启动换电流程 -//StationSoftMgr.SwappingStateMachineStart(); -//StationSoftMgr.StartTasks(); +if (AppSettingsHelper.GetBool("swap", "enable")) +{ + StationSoftMgr.SwappingStateMachineStart(); +} + +//Task +if (AppSettingsHelper.GetBool("task", "enable")) +{ + StationSoftMgr.StartTasks(); +} + + app.Run(); \ No newline at end of file diff --git a/WebStarter/Properties/launchSettings.json b/WebStarter/Properties/launchSettings.json index 7821295..a6b7187 100644 --- a/WebStarter/Properties/launchSettings.json +++ b/WebStarter/Properties/launchSettings.json @@ -16,7 +16,8 @@ "launchUrl": "swagger", "applicationUrl": "http://0.0.0.0:5034", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + "profiles_active": "dev" } }, "IIS Express": { @@ -24,7 +25,9 @@ "launchBrowser": true, "launchUrl": "swagger", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Development", + "applicationUrl": "http://0.0.0.0:5034", + "profiles_active": "dev" } } } diff --git a/WebStarter/WebStarter.csproj b/WebStarter/WebStarter.csproj index 2a21048..6826f80 100644 --- a/WebStarter/WebStarter.csproj +++ b/WebStarter/WebStarter.csproj @@ -29,7 +29,7 @@ - + Always diff --git a/WebStarter/appsettings.Development.json b/WebStarter/appsettings.Development.json deleted file mode 100644 index 0c208ae..0000000 --- a/WebStarter/appsettings.Development.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - } -} diff --git a/WebStarter/appsettings.dev.json b/WebStarter/appsettings.dev.json new file mode 100644 index 0000000..0e542e6 --- /dev/null +++ b/WebStarter/appsettings.dev.json @@ -0,0 +1,91 @@ +{ + "ConnectionStrings": { + "ConfigId": "master", + "DbType": "MySql", + "SqlConnection": "server=192.168.2.2;Port=3306;Database=huanneng_dev;Uid=root;Pwd=Rszn123;Charset=utf8;" + }, + "Update": { + "AutoUpdate": "false", + "Version": "1.1.0.1", + "Url": "http://121.4.95.243:8090/Updates/AutoUpdaterStarter.xml" + }, + "Redis": { + "Connection": "106.12.36.89:6379,password=123456", + "InstanceName": "local", + "DefaultDB": "8" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + ",": null, + "Cryptogram": { + "StrongPassword": "false", // 是否开启密码强度验证 + "PasswordStrengthValidation": "(?=^.{6,16}$)(?=.*\\d)(?=.*\\W+)(?=.*[A-Z])(?=.*[a-z])(?!.*\\n).*$", // 密码强度验证正则表达式,必须须包含大小写字母、数字和特殊字符的组合,长度在6-16之间 + "PasswordStrengthValidationMsg": "密码必须包含大小写字母、数字和特殊字符的组合,长度在6-16之间", // 密码强度验证消息提示 + "CryptoType": "SM2", // 密码加密算法:MD5、SM2、SM4 + "PublicKey": "0484C7466D950E120E5ECE5DD85D0C90EAA85081A3A2BD7C57AE6DC822EFCCBD66620C67B0103FC8DD280E36C3B282977B722AAEC3C56518EDCEBAFB72C5A05312", // 公钥 + "PrivateKey": "8EDB615B1D48B8BE188FC0F18EC08A41DF50EA731FA28BF409E6552809E3A111" // 私钥 + }, + //Login + "TokenOptions": { + "SecurityKey": "s4104j1401kopposdfjsfj091541111111111", + "Domain": "*", + "Audience": "jwtAudience", + "Issuer": "jwtIssuer" + }, + "Upload": { + "Path": "Upload/{yyyy}/{MM}/{dd}", // 文件上传目录 + "MaxSize": 20480, // 文件最大限制KB:1024*20 + "ContentType": [ "image/jpg", "image/png", "image/jpeg", "image/gif", "image/bmp", "text/plain", "application/pdf", "application/msword", "application/vnd.ms-excel", "application/vnd.ms-powerpoint", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "video/mp4" ], + "EnableMd5": false // 启用文件MDF5验证-防止重复上传 + }, + //SysLogin + "JWTSettings": { + "ValidateIssuerSigningKey": true, // 是否验证密钥,bool 类型,默认true + "IssuerSigningKey": "3c1cbc3f546eda35168c3aa3cb91780fbe703f0996c6d123ea96dc85c70bbc0a", // 密钥,string 类型,必须是复杂密钥,长度大于16 + "ValidateIssuer": true, // 是否验证签发方,bool 类型,默认true + "ValidIssuer": "Admin.NET", // 签发方,string 类型 + "ValidateAudience": true, // 是否验证签收方,bool 类型,默认true + "ValidAudience": "Admin.NET", // 签收方,string 类型 + "ValidateLifetime": true, // 是否验证过期时间,bool 类型,默认true,建议true + //"ExpiredTime": 20, // 过期时间,long 类型,单位分钟,默认20分钟,最大支持 13 年 + "ClockSkew": 5, // 过期时间容错值,long 类型,单位秒,默认5秒 + "Algorithm": "HS256", // 加密算法,string 类型,默认 HS256 + "RequireExpirationTime": true // 验证过期时间,设置 false 将永不过期 + }, + + + "SnowId": { + "WorkerId": 1, // 机器码 全局唯一 + "WorkerIdBitLength": 6, // 机器码位长 默认值6,取值范围 [1, 19] + "SeqBitLength": 6, // 序列数位长 默认值6,取值范围 [3, 21](建议不小于4,值越大性能越高、Id位数也更长) + "WorkerPrefix": "adminnet_" // 缓存前缀 + }, + + "HttpContextRequest": { + "Scheme": "" + }, + "Kestrel": { + "Endpoints": { + "http": { + "Url": "http://*:15034" + } + } + }, + "cloud": { + "enable": true + }, + "plc": { + "enable": true + }, + "swap": { + "enable": true + }, + "task": { + "enable": true + } +} \ No newline at end of file diff --git a/WebStarter/appsettings.json b/WebStarter/appsettings.json index c9a1fbc..0c208ae 100644 --- a/WebStarter/appsettings.json +++ b/WebStarter/appsettings.json @@ -1,79 +1,8 @@ { - "ConnectionStrings": { - "ConfigId": "master", - "DbType": "MySql", - "SqlConnection": "server=192.168.2.2;Port=3306;Database=huanneng_dev;Uid=root;Pwd=Rszn123;Charset=utf8;" - }, - "Update": { - "AutoUpdate": "false", - "Version": "1.1.0.1", - "Url": "http://121.4.95.243:8090/Updates/AutoUpdaterStarter.xml" - }, - "Redis": { - "Connection": "106.12.36.89:6379,password=123456", - "InstanceName": "local", - "DefaultDB": "8" - }, "Logging": { "LogLevel": { "Default": "Information", "Microsoft.AspNetCore": "Warning" } - }, - "AllowedHosts": "*", - ",": null, - "Cryptogram": { - "StrongPassword": "false", // 是否开启密码强度验证 - "PasswordStrengthValidation": "(?=^.{6,16}$)(?=.*\\d)(?=.*\\W+)(?=.*[A-Z])(?=.*[a-z])(?!.*\\n).*$", // 密码强度验证正则表达式,必须须包含大小写字母、数字和特殊字符的组合,长度在6-16之间 - "PasswordStrengthValidationMsg": "密码必须包含大小写字母、数字和特殊字符的组合,长度在6-16之间", // 密码强度验证消息提示 - "CryptoType": "SM2", // 密码加密算法:MD5、SM2、SM4 - "PublicKey": "0484C7466D950E120E5ECE5DD85D0C90EAA85081A3A2BD7C57AE6DC822EFCCBD66620C67B0103FC8DD280E36C3B282977B722AAEC3C56518EDCEBAFB72C5A05312", // 公钥 - "PrivateKey": "8EDB615B1D48B8BE188FC0F18EC08A41DF50EA731FA28BF409E6552809E3A111" // 私钥 - }, - //Login - "TokenOptions": { - "SecurityKey": "s4104j1401kopposdfjsfj091541111111111", - "Domain": "*", - "Audience": "jwtAudience", - "Issuer": "jwtIssuer" - }, - "Upload": { - "Path": "Upload/{yyyy}/{MM}/{dd}", // 文件上传目录 - "MaxSize": 20480, // 文件最大限制KB:1024*20 - "ContentType": [ "image/jpg", "image/png", "image/jpeg", "image/gif", "image/bmp", "text/plain", "application/pdf", "application/msword", "application/vnd.ms-excel", "application/vnd.ms-powerpoint", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "video/mp4" ], - "EnableMd5": false // 启用文件MDF5验证-防止重复上传 - }, - //SysLogin - "JWTSettings": { - "ValidateIssuerSigningKey": true, // 是否验证密钥,bool 类型,默认true - "IssuerSigningKey": "3c1cbc3f546eda35168c3aa3cb91780fbe703f0996c6d123ea96dc85c70bbc0a", // 密钥,string 类型,必须是复杂密钥,长度大于16 - "ValidateIssuer": true, // 是否验证签发方,bool 类型,默认true - "ValidIssuer": "Admin.NET", // 签发方,string 类型 - "ValidateAudience": true, // 是否验证签收方,bool 类型,默认true - "ValidAudience": "Admin.NET", // 签收方,string 类型 - "ValidateLifetime": true, // 是否验证过期时间,bool 类型,默认true,建议true - //"ExpiredTime": 20, // 过期时间,long 类型,单位分钟,默认20分钟,最大支持 13 年 - "ClockSkew": 5, // 过期时间容错值,long 类型,单位秒,默认5秒 - "Algorithm": "HS256", // 加密算法,string 类型,默认 HS256 - "RequireExpirationTime": true // 验证过期时间,设置 false 将永不过期 - }, - - - "SnowId": { - "WorkerId": 1, // 机器码 全局唯一 - "WorkerIdBitLength": 6, // 机器码位长 默认值6,取值范围 [1, 19] - "SeqBitLength": 6, // 序列数位长 默认值6,取值范围 [3, 21](建议不小于4,值越大性能越高、Id位数也更长) - "WorkerPrefix": "adminnet_" // 缓存前缀 - }, - - "HttpContextRequest": { - "Scheme": "http://0.0.0.0:5034" - }, - "Kestrel": { - "Endpoints": { - "http": { - "Url": "http://0.0.0.0:5034" - } - } } } diff --git a/WebStarter/appsettings.prod.json b/WebStarter/appsettings.prod.json new file mode 100644 index 0000000..1b2eb56 --- /dev/null +++ b/WebStarter/appsettings.prod.json @@ -0,0 +1,125 @@ +{ + "ConnectionStrings": { + "ConfigId": "master", + "DbType": "MySql", + "SqlConnection": "server=192.168.2.2;Port=3306;Database=huanneng_dev;Uid=root;Pwd=Rszn123;Charset=utf8;" + }, + "Update": { + "AutoUpdate": "false", + "Version": "1.1.0.1", + "Url": "http://121.4.95.243:8090/Updates/AutoUpdaterStarter.xml" + }, + "Redis": { + "Connection": "106.12.36.89:6379,password=123456", + "InstanceName": "local", + "DefaultDB": "8" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + ",": null, + "Cryptogram": { + "StrongPassword": "false", + // 是否开启密码强度验证 + "PasswordStrengthValidation": "(?=^.{6,16}$)(?=.*\\d)(?=.*\\W+)(?=.*[A-Z])(?=.*[a-z])(?!.*\\n).*$", + // 密码强度验证正则表达式,必须须包含大小写字母、数字和特殊字符的组合,长度在6-16之间 + "PasswordStrengthValidationMsg": "密码必须包含大小写字母、数字和特殊字符的组合,长度在6-16之间", + // 密码强度验证消息提示 + "CryptoType": "SM2", + // 密码加密算法:MD5、SM2、SM4 + "PublicKey": "0484C7466D950E120E5ECE5DD85D0C90EAA85081A3A2BD7C57AE6DC822EFCCBD66620C67B0103FC8DD280E36C3B282977B722AAEC3C56518EDCEBAFB72C5A05312", + // 公钥 + "PrivateKey": "8EDB615B1D48B8BE188FC0F18EC08A41DF50EA731FA28BF409E6552809E3A111" + // 私钥 + }, + //Login + "TokenOptions": { + "SecurityKey": "s4104j1401kopposdfjsfj091541111111111", + "Domain": "*", + "Audience": "jwtAudience", + "Issuer": "jwtIssuer" + }, + "Upload": { + "Path": "Upload/{yyyy}/{MM}/{dd}", + // 文件上传目录 + "MaxSize": 20480, + // 文件最大限制KB:1024*20 + "ContentType": [ + "image/jpg", + "image/png", + "image/jpeg", + "image/gif", + "image/bmp", + "text/plain", + "application/pdf", + "application/msword", + "application/vnd.ms-excel", + "application/vnd.ms-powerpoint", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "video/mp4" + ], + "EnableMd5": false + // 启用文件MDF5验证-防止重复上传 + }, + //SysLogin + "JWTSettings": { + "ValidateIssuerSigningKey": true, + // 是否验证密钥,bool 类型,默认true + "IssuerSigningKey": "3c1cbc3f546eda35168c3aa3cb91780fbe703f0996c6d123ea96dc85c70bbc0a", + // 密钥,string 类型,必须是复杂密钥,长度大于16 + "ValidateIssuer": true, + // 是否验证签发方,bool 类型,默认true + "ValidIssuer": "Admin.NET", + // 签发方,string 类型 + "ValidateAudience": true, + // 是否验证签收方,bool 类型,默认true + "ValidAudience": "Admin.NET", + // 签收方,string 类型 + "ValidateLifetime": true, + // 是否验证过期时间,bool 类型,默认true,建议true + //"ExpiredTime": 20, // 过期时间,long 类型,单位分钟,默认20分钟,最大支持 13 年 + "ClockSkew": 5, + // 过期时间容错值,long 类型,单位秒,默认5秒 + "Algorithm": "HS256", + // 加密算法,string 类型,默认 HS256 + "RequireExpirationTime": true + // 验证过期时间,设置 false 将永不过期 + }, + "SnowId": { + "WorkerId": 1, + // 机器码 全局唯一 + "WorkerIdBitLength": 6, + // 机器码位长 默认值6,取值范围 [1, 19] + "SeqBitLength": 6, + // 序列数位长 默认值6,取值范围 [3, 21](建议不小于4,值越大性能越高、Id位数也更长) + "WorkerPrefix": "adminnet_" + // 缓存前缀 + }, + "HttpContextRequest": { + "Scheme": "http://0.0.0.0:5034" + }, + "Kestrel": { + "Endpoints": { + "http": { + "Url": "http://*:5034" + } + } + }, + "cloud": { + "enable": true + }, + "plc": { + "enable": true + }, + "swap": { + "enable": true + }, + "task": { + "enable": true + } +} diff --git a/WebStarter/bin/Debug/net6.0/appsettings.Development.json b/WebStarter/bin/Debug/net6.0/appsettings.Development.json deleted file mode 100644 index 0c208ae..0000000 --- a/WebStarter/bin/Debug/net6.0/appsettings.Development.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - } -}