😎1、增加是否开启定时任务配置 2、整理配置文件
This commit is contained in:
parent
ed32d75357
commit
3a9ce81b52
@ -1,10 +1,8 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
|
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
|
||||||
|
|
||||||
"Urls": "http://*:5005", // 配置默认端口
|
"Urls": "http://*:5005", // 默认端口
|
||||||
// "https_port": 44325,
|
"AllowedHosts": "*", // 允许所有地址
|
||||||
|
|
||||||
"AllowedHosts": "*",
|
|
||||||
|
|
||||||
"AppSettings": {
|
"AppSettings": {
|
||||||
"InjectSpecificationDocument": true, // 生产环境是否开启Swagger
|
"InjectSpecificationDocument": true, // 生产环境是否开启Swagger
|
||||||
@ -30,23 +28,29 @@
|
|||||||
"DateTimeFormatCulture": "zh-CN" // 固定时间区域为特定时区(多语言)
|
"DateTimeFormatCulture": "zh-CN" // 固定时间区域为特定时区(多语言)
|
||||||
},
|
},
|
||||||
"CorsAccessorSettings": {
|
"CorsAccessorSettings": {
|
||||||
//"PolicyName": "App.Cors.Policy",
|
//"PolicyName": "App.Cors.Policy", // 跨域策略名称
|
||||||
//"WithOrigins": [ "http://localhost:5005", "https://gitee.com" ],
|
//"WithOrigins": [ "http://localhost:5005", "https://gitee.com" ], // 允许的跨域地址
|
||||||
"WithExposedHeaders": [ "Content-Disposition", "X-Pagination", "access-token", "x-access-token", "Access-Control-Expose-Headersx-access-token" ], // 如果前端不代理且是axios请求
|
"WithExposedHeaders": [ "Content-Disposition", "X-Pagination", "access-token", "x-access-token", "Access-Control-Expose-Headersx-access-token" ], // 如果前端不代理且是axios请求
|
||||||
"SignalRSupport": true // 启用 SignalR 跨域支持
|
"SignalRSupport": true // 启用 SignalR 跨域支持
|
||||||
},
|
},
|
||||||
|
// 定时任务/调度作业
|
||||||
|
"ScheduleJob": {
|
||||||
|
"Enabled": true // 是否开启
|
||||||
|
},
|
||||||
|
// 雪花Id
|
||||||
"SnowId": {
|
"SnowId": {
|
||||||
"WorkerId": 1, // 机器码 全局唯一
|
"WorkerId": 1, // 雪花Id机器码,多服务器时全局唯一
|
||||||
"WorkerIdBitLength": 6, // 机器码位长 默认值6,取值范围 [1, 19]
|
"WorkerIdBitLength": 6, // 机器码位长 默认值6,取值范围 [1, 19]
|
||||||
"SeqBitLength": 6, // 序列数位长 默认值6,取值范围 [3, 21](建议不小于4,值越大性能越高、Id位数也更长)
|
"SeqBitLength": 6, // 序列数位长 默认值6,取值范围 [3, 21](建议不小于4,值越大性能越高、Id位数也更长)
|
||||||
"WorkerPrefix": "adminnet_" // 缓存前缀
|
"WorkerPrefix": "adminnet_" // 缓存前缀
|
||||||
},
|
},
|
||||||
|
// 密码策略
|
||||||
"Cryptogram": {
|
"Cryptogram": {
|
||||||
"StrongPassword": false, // 是否开启密码强度验证
|
"StrongPassword": false, // 是否开启密码强度验证
|
||||||
"PasswordStrengthValidation": "(?=^.{6,16}$)(?=.*\\d)(?=.*\\W+)(?=.*[A-Z])(?=.*[a-z])(?!.*\\n).*$", // 密码强度验证正则表达式,必须须包含大小写字母、数字和特殊字符的组合,长度在6-16之间
|
"PasswordStrengthValidation": "(?=^.{6,16}$)(?=.*\\d)(?=.*\\W+)(?=.*[A-Z])(?=.*[a-z])(?!.*\\n).*$", // 密码强度验证正则表达式,必须须包含大小写字母、数字和特殊字符的组合,长度在6-16之间
|
||||||
"PasswordStrengthValidationMsg": "密码必须包含大小写字母、数字和特殊字符的组合,长度在6-16之间", // 密码强度验证消息提示
|
"PasswordStrengthValidationMsg": "密码必须包含大小写字母、数字和特殊字符的组合,长度在6-16之间", // 密码强度验证消息提示
|
||||||
"CryptoType": "SM2", // 密码加密算法:MD5、SM2、SM4
|
"CryptoType": "SM2", // 密码加密算法:MD5、SM2、SM4
|
||||||
// 新业务系统记得改密匙,通过接口(http://localhost:5005/api/sysCommon/smKeyPair)获取。记得同步修改前端公钥配置:VITE_SM_PUBLIC_KEY
|
// 新业务系统记得改密匙,通过接口(http://localhost:5005/api/sysCommon/smKeyPair)获取。前端公钥配置:VITE_SM_PUBLIC_KEY,前后端必须保持一致,数据库建好后密匙也就固定了。
|
||||||
"PublicKey": "04851D329AA3E38C2E7670AFE70E6E70E92F8769CA27C8766B12209A0FFBA4493B603EF7A0B9B1E16F0E8930C0406EA0B179B68DF28E25334BDEC4AE76D907E9E9", // 公钥
|
"PublicKey": "04851D329AA3E38C2E7670AFE70E6E70E92F8769CA27C8766B12209A0FFBA4493B603EF7A0B9B1E16F0E8930C0406EA0B179B68DF28E25334BDEC4AE76D907E9E9", // 公钥
|
||||||
"PrivateKey": "3A61D1D30C6302DABFF36201D936D0143EEF0C850AF28C5CA6D5C045AF8C5C8A" // 私钥
|
"PrivateKey": "3A61D1D30C6302DABFF36201D936D0143EEF0C850AF28C5CA6D5C045AF8C5C8A" // 私钥
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
|
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
|
||||||
|
|
||||||
|
// 缓存配置
|
||||||
"Cache": {
|
"Cache": {
|
||||||
"Prefix": "adminnet_", // 全局缓存前缀
|
"Prefix": "adminnet_", // 全局缓存前缀
|
||||||
"CacheType": "Memory", // Memory、Redis
|
"CacheType": "Memory", // Memory、Redis
|
||||||
@ -11,7 +12,8 @@
|
|||||||
"AutoDetect": false // 自动检测集群节点 阿里云的Redis分布式集群使用代理模式,需要设置为false关闭自动检测;如果不用代理地址,就配置多个节点地址并打开自动检测
|
"AutoDetect": false // 自动检测集群节点 阿里云的Redis分布式集群使用代理模式,需要设置为false关闭自动检测;如果不用代理地址,就配置多个节点地址并打开自动检测
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Cluster": { // 集群配置
|
// 集群配置
|
||||||
|
"Cluster": {
|
||||||
"Enabled": false, // 启用集群:前提开启Redis缓存模式
|
"Enabled": false, // 启用集群:前提开启Redis缓存模式
|
||||||
"ServerId": "adminnet", // 服务器标识
|
"ServerId": "adminnet", // 服务器标识
|
||||||
"ServerIp": "", // 服务器IP
|
"ServerIp": "", // 服务器IP
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
// 代码生成配置项-程序集名称集合
|
// 代码生成配置项-程序集名称集合
|
||||||
"CodeGen": {
|
"CodeGen": {
|
||||||
"EntityAssemblyNames": [ "Admin.NET.Core", "Admin.NET.Application" ], // 实体所在程序集
|
"EntityAssemblyNames": [ "Admin.NET.Core", "Admin.NET.Application" ], // 实体所在程序集(自行添加新建程序集名称)
|
||||||
"BaseEntityNames": [ "EntityTenantId", "EntityTenant", "EntityTenantBaseData", "EntityBaseData", "EntityBase", "EntityBaseId" ], // 实体基类名称
|
"BaseEntityNames": [ "EntityTenantId", "EntityTenant", "EntityTenantBaseData", "EntityBaseData", "EntityBase", "EntityBaseId" ], // 实体基类名称
|
||||||
"EntityBaseColumn": {
|
"EntityBaseColumn": {
|
||||||
"EntityTenantId": [ "Id", "TenantId" ],
|
"EntityTenantId": [ "Id", "TenantId" ],
|
||||||
@ -12,9 +12,8 @@
|
|||||||
"EntityBaseData": [ "Id", "CreateTime", "UpdateTime", "CreateUserId", "UpdateUserId", "CreateUserName", "UpdateUserName", "IsDelete", "CreateOrgId", "CreateOrgName" ],
|
"EntityBaseData": [ "Id", "CreateTime", "UpdateTime", "CreateUserId", "UpdateUserId", "CreateUserName", "UpdateUserName", "IsDelete", "CreateOrgId", "CreateOrgName" ],
|
||||||
"EntityBase": [ "Id", "CreateTime", "UpdateTime", "CreateUserId", "UpdateUserId", "CreateUserName", "UpdateUserName", "IsDelete" ],
|
"EntityBase": [ "Id", "CreateTime", "UpdateTime", "CreateUserId", "UpdateUserId", "CreateUserName", "UpdateUserName", "IsDelete" ],
|
||||||
"EntityBaseId": [ "Id" ]
|
"EntityBaseId": [ "Id" ]
|
||||||
//"BaseId": [ "Id" ]
|
|
||||||
},
|
},
|
||||||
"FrontRootPath": "Web", // 前端项目根目录
|
"FrontRootPath": "Web", // 前端项目根目录
|
||||||
"BackendApplicationNamespaces": [ "Admin.NET.Application", "Admin.NET.Application2" ] // 后端生成到的项目
|
"BackendApplicationNamespaces": [ "Admin.NET.Application", "Admin.NET.Application2" ] // 后端生成到的项目(自行添加新建命名空间)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9,11 +9,11 @@
|
|||||||
{
|
{
|
||||||
//"ConfigId": "1300000000001", // 默认库标识-禁止修改
|
//"ConfigId": "1300000000001", // 默认库标识-禁止修改
|
||||||
"DbType": "Sqlite", // MySql、SqlServer、Sqlite、Oracle、PostgreSQL、Dm、Kdbndp、Oscar、MySqlConnector、Access、OpenGauss、QuestDB、HG、ClickHouse、GBase、Odbc、Custom
|
"DbType": "Sqlite", // MySql、SqlServer、Sqlite、Oracle、PostgreSQL、Dm、Kdbndp、Oscar、MySqlConnector、Access、OpenGauss、QuestDB、HG、ClickHouse、GBase、Odbc、Custom
|
||||||
"ConnectionString": "DataSource=./Admin.NET.db", // Sqlite 库连接字符串
|
"ConnectionString": "DataSource=./Admin.NET.db", // Sqlite
|
||||||
//"ConnectionString": "PORT=5432;DATABASE=xxx;HOST=localhost;PASSWORD=xxx;USER ID=xxx", // PostgreSQL 库连接字符串
|
//"ConnectionString": "PORT=5432;DATABASE=xxx;HOST=localhost;PASSWORD=xxx;USER ID=xxx", // PostgreSQL
|
||||||
//"ConnectionString": "Server=localhost;Database=xxx;Uid=xxx;Pwd=xxx;SslMode=None;", // MySql 库连接字符串",
|
//"ConnectionString": "Server=localhost;Database=xxx;Uid=xxx;Pwd=xxx;SslMode=None;", // MySql,
|
||||||
//"ConnectionString": "User Id=xxx; Password=xxx; Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)))", // Oracle 库连接字符串
|
//"ConnectionString": "User Id=xxx; Password=xxx; Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)))", // Oracle
|
||||||
//"ConnectionString": "Server=localhost;Database=xxx;User Id=xxx;Password=xxx;", // SqlServer 库连接字符串
|
//"ConnectionString": "Server=localhost;Database=xxx;User Id=xxx;Password=xxx;", // SqlServer
|
||||||
|
|
||||||
//"SlaveConnectionConfigs": [ // 读写分离/主从
|
//"SlaveConnectionConfigs": [ // 读写分离/主从
|
||||||
// {
|
// {
|
||||||
@ -26,17 +26,17 @@
|
|||||||
// }
|
// }
|
||||||
//],
|
//],
|
||||||
"DbSettings": {
|
"DbSettings": {
|
||||||
"EnableInitDb": true, // 启用库初始化
|
"EnableInitDb": true, // 启用库初始化(若实体没有变化建议关闭)
|
||||||
"EnableDiffLog": false, // 启用库表差异日志
|
"EnableDiffLog": false, // 启用库表差异日志
|
||||||
"EnableUnderLine": false // 启用驼峰转下划线
|
"EnableUnderLine": false // 启用驼峰转下划线
|
||||||
},
|
},
|
||||||
"TableSettings": {
|
"TableSettings": {
|
||||||
"EnableInitTable": true, // 启用表初始化
|
"EnableInitTable": true, // 启用表初始化(若实体没有变化建议关闭)
|
||||||
"EnableIncreTable": false // 启用表增量更新-特性[IncreTable]
|
"EnableIncreTable": false // 启用表增量更新(只更新贴了特性[IncreTable]的实体表)
|
||||||
},
|
},
|
||||||
"SeedSettings": {
|
"SeedSettings": {
|
||||||
"EnableInitSeed": true, // 启用种子初始化
|
"EnableInitSeed": true, // 启用种子初始化(若种子没有变化建议关闭)
|
||||||
"EnableIncreSeed": false // 启用种子增量更新-特性[IncreSeed]
|
"EnableIncreSeed": false // 启用种子增量更新(只更新贴了特性[IncreSeed]的种子表)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//// 日志独立数据库配置
|
//// 日志独立数据库配置
|
||||||
@ -45,17 +45,17 @@
|
|||||||
// "DbType": "Sqlite",
|
// "DbType": "Sqlite",
|
||||||
// "ConnectionString": "DataSource=./Admin.NET.Log.db", // 库连接字符串
|
// "ConnectionString": "DataSource=./Admin.NET.Log.db", // 库连接字符串
|
||||||
// "DbSettings": {
|
// "DbSettings": {
|
||||||
// "EnableInitDb": true, // 启用库初始化
|
// "EnableInitDb": true, // 启用库初始化(若实体没有变化建议关闭)
|
||||||
// "EnableDiffLog": false, // 启用库表差异日志
|
// "EnableDiffLog": false, // 启用库表差异日志
|
||||||
// "EnableUnderLine": false // 启用驼峰转下划线
|
// "EnableUnderLine": false // 启用驼峰转下划线
|
||||||
// },
|
// },
|
||||||
// "TableSettings": {
|
// "TableSettings": {
|
||||||
// "EnableInitTable": true, // 启用表初始化
|
// "EnableInitTable": true, // 启用表初始化(若实体没有变化建议关闭)
|
||||||
// "EnableIncreTable": false // 启用表增量更新-特性[IncreTable]
|
// "EnableIncreTable": false // 启用表增量更新(只更新贴了特性[IncreTable]的实体表)
|
||||||
// },
|
// },
|
||||||
// "SeedSettings": {
|
// "SeedSettings": {
|
||||||
// "EnableInitSeed": false, // 启用种子初始化
|
// "EnableInitSeed": false, // 启用种子初始化(若种子没有变化建议关闭)
|
||||||
// "EnableIncreSeed": false // 启用种子增量更新-特性[IncreSeed]
|
// "EnableIncreSeed": false // 启用种子增量更新(只更新贴了特性[IncreSeed]的种子表)
|
||||||
// }
|
// }
|
||||||
//},
|
//},
|
||||||
//// 其他数据库配置(可以配置多个)
|
//// 其他数据库配置(可以配置多个)
|
||||||
@ -64,17 +64,17 @@
|
|||||||
// "DbType": "Sqlite", // 库类型
|
// "DbType": "Sqlite", // 库类型
|
||||||
// "ConnectionString": "DataSource=./Admin.NET.Test.db", // 库连接字符串
|
// "ConnectionString": "DataSource=./Admin.NET.Test.db", // 库连接字符串
|
||||||
// "DbSettings": {
|
// "DbSettings": {
|
||||||
// "EnableInitDb": true, // 启用库初始化
|
// "EnableInitDb": true, // 启用库初始化(若实体没有变化建议关闭)
|
||||||
// "EnableDiffLog": false, // 启用库表差异日志
|
// "EnableDiffLog": false, // 启用库表差异日志
|
||||||
// "EnableUnderLine": false // 启用驼峰转下划线
|
// "EnableUnderLine": false // 启用驼峰转下划线
|
||||||
// },
|
// },
|
||||||
// "TableSettings": {
|
// "TableSettings": {
|
||||||
// "EnableInitTable": true, // 启用表初始化
|
// "EnableInitTable": true, // 启用表初始化(若实体没有变化建议关闭)
|
||||||
// "EnableIncreTable": false // 启用表增量更新-特性[IncreTable]
|
// "EnableIncreTable": false // 启用表增量更新(只更新贴了特性[IncreTable]的实体表)
|
||||||
// },
|
// },
|
||||||
// "SeedSettings": {
|
// "SeedSettings": {
|
||||||
// "EnableInitSeed": true, // 启用种子初始化
|
// "EnableInitSeed": true, // 启用种子初始化(若种子没有变化建议关闭)
|
||||||
// "EnableIncreSeed": false // 启用种子增量更新-特性[IncreSeed]
|
// "EnableIncreSeed": false // 启用种子增量更新(只更新贴了特性[IncreSeed]的种子表)
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
]
|
]
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
|
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
|
||||||
|
|
||||||
|
// 邮箱配置
|
||||||
"Email": {
|
"Email": {
|
||||||
"Host": "smtp.163.com", // 主机
|
"Host": "smtp.163.com", // 主机
|
||||||
"Port": 465, // 端口 465、994、25
|
"Port": 465, // 端口 465、994、25
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
|
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
|
||||||
|
|
||||||
// 枚举实体所在程序集名称集合
|
// 枚举配置(将所有枚举转成字典)
|
||||||
"Enum": {
|
"Enum": {
|
||||||
"EntityAssemblyNames": [ "Admin." ]
|
"EntityAssemblyNames": [ "Admin." ] // 枚举所在程序集(自行添加新建程序集名称)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -18,7 +18,7 @@
|
|||||||
},
|
},
|
||||||
"Database": {
|
"Database": {
|
||||||
"Enabled": true, // 启用数据库日志
|
"Enabled": true, // 启用数据库日志
|
||||||
"MinimumLevel": "Information"
|
"MinimumLevel": "Information" // 日志级别
|
||||||
},
|
},
|
||||||
"ElasticSearch": {
|
"ElasticSearch": {
|
||||||
"Enabled": false, // 启用ES日志
|
"Enabled": false, // 启用ES日志
|
||||||
|
|||||||
@ -1,7 +1,9 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
|
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
|
||||||
|
|
||||||
|
// 短信配置
|
||||||
"SMS": {
|
"SMS": {
|
||||||
|
// 阿里云短信
|
||||||
"Aliyun": {
|
"Aliyun": {
|
||||||
"AccessKeyId": "",
|
"AccessKeyId": "",
|
||||||
"AccessKeySecret": "",
|
"AccessKeySecret": "",
|
||||||
@ -20,6 +22,7 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
// 腾讯云短信
|
||||||
"Tencentyun": {
|
"Tencentyun": {
|
||||||
"SdkAppId": "",
|
"SdkAppId": "",
|
||||||
"AccessKeyId": "",
|
"AccessKeyId": "",
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
"EnableMd5": false // 启用文件MDF5验证-防止重复上传
|
"EnableMd5": false // 启用文件MDF5验证-防止重复上传
|
||||||
},
|
},
|
||||||
"OSSProvider": {
|
"OSSProvider": {
|
||||||
"IsEnable": false,
|
"Enabled": false,
|
||||||
"Provider": "Minio", // OSS提供者 Invalid/Minio/Aliyun/QCloud/Qiniu/HuaweiCloud
|
"Provider": "Minio", // OSS提供者 Invalid/Minio/Aliyun/QCloud/Qiniu/HuaweiCloud
|
||||||
"Endpoint": "xxx.xxx.xxx.xxx:8090", // 节点/API地址(在腾讯云OSS中表示AppId)
|
"Endpoint": "xxx.xxx.xxx.xxx:8090", // 节点/API地址(在腾讯云OSS中表示AppId)
|
||||||
"Region": "xxx.xxx.xxx.xxx", // 地域
|
"Region": "xxx.xxx.xxx.xxx", // 地域
|
||||||
@ -20,7 +20,7 @@
|
|||||||
"CustomHost": "" // 自定义Host:拼接外链的Host,若空则使用Endpoint拼接
|
"CustomHost": "" // 自定义Host:拼接外链的Host,若空则使用Endpoint拼接
|
||||||
},
|
},
|
||||||
"SSHProvider": {
|
"SSHProvider": {
|
||||||
"IsEnable": false,
|
"Enabled": false,
|
||||||
"Host": "127.0.0.1",
|
"Host": "127.0.0.1",
|
||||||
"Port": 8222,
|
"Port": 8222,
|
||||||
"Username": "sshuser",
|
"Username": "sshuser",
|
||||||
|
|||||||
@ -41,7 +41,7 @@
|
|||||||
<PackageReference Include="SqlSugarCore" Version="5.1.4.167" />
|
<PackageReference Include="SqlSugarCore" Version="5.1.4.167" />
|
||||||
<PackageReference Include="SSH.NET" Version="2024.1.0" />
|
<PackageReference Include="SSH.NET" Version="2024.1.0" />
|
||||||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.5" />
|
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.4.5" />
|
||||||
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1085" />
|
<PackageReference Include="TencentCloudSDK.Sms" Version="3.0.1087" />
|
||||||
<PackageReference Include="UAParser" Version="3.1.47" />
|
<PackageReference Include="UAParser" Version="3.1.47" />
|
||||||
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
|
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@ -43,7 +43,7 @@ public sealed class OSSProviderOptions : OSSOptions, IConfigurableOptions
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否启用OSS存储
|
/// 是否启用OSS存储
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsEnable { get; set; }
|
public bool Enabled { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 自定义桶名称 不能直接使用Provider来替代桶名称
|
/// 自定义桶名称 不能直接使用Provider来替代桶名称
|
||||||
|
|||||||
@ -32,7 +32,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
_sysFileRep = sysFileRep;
|
_sysFileRep = sysFileRep;
|
||||||
_OSSProviderOptions = oSSProviderOptions.Value;
|
_OSSProviderOptions = oSSProviderOptions.Value;
|
||||||
_uploadOptions = uploadOptions.Value;
|
_uploadOptions = uploadOptions.Value;
|
||||||
if (_OSSProviderOptions.IsEnable)
|
if (_OSSProviderOptions.Enabled)
|
||||||
_OSSService = ossServiceFactory.Create(Enum.GetName(_OSSProviderOptions.Provider));
|
_OSSService = ossServiceFactory.Create(Enum.GetName(_OSSProviderOptions.Provider));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,12 +120,12 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
var fileName = HttpUtility.UrlEncode(file.FileName, Encoding.GetEncoding("UTF-8"));
|
var fileName = HttpUtility.UrlEncode(file.FileName, Encoding.GetEncoding("UTF-8"));
|
||||||
var filePath = Path.Combine(file.FilePath, file.Id.ToString() + file.Suffix);
|
var filePath = Path.Combine(file.FilePath, file.Id.ToString() + file.Suffix);
|
||||||
|
|
||||||
if (_OSSProviderOptions.IsEnable)
|
if (_OSSProviderOptions.Enabled)
|
||||||
{
|
{
|
||||||
var stream = await (await _OSSService.PresignedGetObjectAsync(file.BucketName.ToString(), filePath, 5)).GetAsStreamAsync();
|
var stream = await (await _OSSService.PresignedGetObjectAsync(file.BucketName.ToString(), filePath, 5)).GetAsStreamAsync();
|
||||||
return new FileStreamResult(stream.Stream, "application/octet-stream") { FileDownloadName = fileName + file.Suffix };
|
return new FileStreamResult(stream.Stream, "application/octet-stream") { FileDownloadName = fileName + file.Suffix };
|
||||||
}
|
}
|
||||||
else if (App.Configuration["SSHProvider:IsEnable"].ToBoolean())
|
else if (App.Configuration["SSHProvider:Enabled"].ToBoolean())
|
||||||
{
|
{
|
||||||
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],
|
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],
|
||||||
App.Configuration["SSHProvider:Port"].ToInt(), App.Configuration["SSHProvider:Username"], App.Configuration["SSHProvider:Password"]))
|
App.Configuration["SSHProvider:Port"].ToInt(), App.Configuration["SSHProvider:Username"], App.Configuration["SSHProvider:Password"]))
|
||||||
@ -152,12 +152,12 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
//var fileName = HttpUtility.UrlEncode(file.FileName, Encoding.GetEncoding("UTF-8"));
|
//var fileName = HttpUtility.UrlEncode(file.FileName, Encoding.GetEncoding("UTF-8"));
|
||||||
var filePath = Path.Combine(file.FilePath, file.Id.ToString() + file.Suffix);
|
var filePath = Path.Combine(file.FilePath, file.Id.ToString() + file.Suffix);
|
||||||
|
|
||||||
if (_OSSProviderOptions.IsEnable)
|
if (_OSSProviderOptions.Enabled)
|
||||||
{
|
{
|
||||||
var stream = await (await _OSSService.PresignedGetObjectAsync(file.BucketName.ToString(), filePath, 5)).GetAsStreamAsync();
|
var stream = await (await _OSSService.PresignedGetObjectAsync(file.BucketName.ToString(), filePath, 5)).GetAsStreamAsync();
|
||||||
return new FileStreamResult(stream.Stream, "application/octet-stream");
|
return new FileStreamResult(stream.Stream, "application/octet-stream");
|
||||||
}
|
}
|
||||||
else if (App.Configuration["SSHProvider:IsEnable"].ToBoolean())
|
else if (App.Configuration["SSHProvider:Enabled"].ToBoolean())
|
||||||
{
|
{
|
||||||
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],
|
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],
|
||||||
App.Configuration["SSHProvider:Port"].ToInt(), App.Configuration["SSHProvider:Username"], App.Configuration["SSHProvider:Password"]))
|
App.Configuration["SSHProvider:Port"].ToInt(), App.Configuration["SSHProvider:Username"], App.Configuration["SSHProvider:Password"]))
|
||||||
@ -180,7 +180,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
[DisplayName("下载指定文件Base64格式")]
|
[DisplayName("下载指定文件Base64格式")]
|
||||||
public async Task<string> DownloadFileBase64([FromBody] string url)
|
public async Task<string> DownloadFileBase64([FromBody] string url)
|
||||||
{
|
{
|
||||||
if (_OSSProviderOptions.IsEnable)
|
if (_OSSProviderOptions.Enabled)
|
||||||
{
|
{
|
||||||
using var httpClient = new HttpClient();
|
using var httpClient = new HttpClient();
|
||||||
HttpResponseMessage response = await httpClient.GetAsync(url);
|
HttpResponseMessage response = await httpClient.GetAsync(url);
|
||||||
@ -195,7 +195,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
throw new HttpRequestException($"Request failed with status code: {response.StatusCode}");
|
throw new HttpRequestException($"Request failed with status code: {response.StatusCode}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (App.Configuration["SSHProvider:IsEnable"].ToBoolean())
|
else if (App.Configuration["SSHProvider:Enabled"].ToBoolean())
|
||||||
{
|
{
|
||||||
var sysFile = await _sysFileRep.CopyNew().GetFirstAsync(u => u.Url == url) ?? throw Oops.Oh($"文件不存在");
|
var sysFile = await _sysFileRep.CopyNew().GetFirstAsync(u => u.Url == url) ?? throw Oops.Oh($"文件不存在");
|
||||||
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],
|
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],
|
||||||
@ -236,11 +236,11 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
{
|
{
|
||||||
await _sysFileRep.DeleteAsync(file);
|
await _sysFileRep.DeleteAsync(file);
|
||||||
|
|
||||||
if (_OSSProviderOptions.IsEnable)
|
if (_OSSProviderOptions.Enabled)
|
||||||
{
|
{
|
||||||
await _OSSService.RemoveObjectAsync(file.BucketName.ToString(), string.Concat(file.FilePath, "/", $"{input.Id}{file.Suffix}"));
|
await _OSSService.RemoveObjectAsync(file.BucketName.ToString(), string.Concat(file.FilePath, "/", $"{input.Id}{file.Suffix}"));
|
||||||
}
|
}
|
||||||
else if (App.Configuration["SSHProvider:IsEnable"].ToBoolean())
|
else if (App.Configuration["SSHProvider:Enabled"].ToBoolean())
|
||||||
{
|
{
|
||||||
var fullPath = string.Concat(file.FilePath, "/", file.Id + file.Suffix);
|
var fullPath = string.Concat(file.FilePath, "/", file.Id + file.Suffix);
|
||||||
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],
|
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],
|
||||||
@ -349,10 +349,10 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
var newFile = new SysFile
|
var newFile = new SysFile
|
||||||
{
|
{
|
||||||
Id = YitIdHelper.NextId(),
|
Id = YitIdHelper.NextId(),
|
||||||
// BucketName = _OSSProviderOptions.IsEnable ? _OSSProviderOptions.Provider.ToString() : "Local",
|
// BucketName = _OSSProviderOptions.Enabled ? _OSSProviderOptions.Provider.ToString() : "Local",
|
||||||
// 阿里云对bucket名称有要求,1.只能包括小写字母,数字,短横线(-)2.必须以小写字母或者数字开头 3.长度必须在3-63字节之间
|
// 阿里云对bucket名称有要求,1.只能包括小写字母,数字,短横线(-)2.必须以小写字母或者数字开头 3.长度必须在3-63字节之间
|
||||||
// 无法使用Provider
|
// 无法使用Provider
|
||||||
BucketName = _OSSProviderOptions.IsEnable ? _OSSProviderOptions.Bucket : "Local",
|
BucketName = _OSSProviderOptions.Enabled ? _OSSProviderOptions.Bucket : "Local",
|
||||||
FileName = Path.GetFileNameWithoutExtension(file.FileName),
|
FileName = Path.GetFileNameWithoutExtension(file.FileName),
|
||||||
Suffix = suffix,
|
Suffix = suffix,
|
||||||
SizeKb = sizeKb,
|
SizeKb = sizeKb,
|
||||||
@ -363,7 +363,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
};
|
};
|
||||||
|
|
||||||
var finalName = newFile.Id + suffix; // 文件最终名称
|
var finalName = newFile.Id + suffix; // 文件最终名称
|
||||||
if (_OSSProviderOptions.IsEnable)
|
if (_OSSProviderOptions.Enabled)
|
||||||
{
|
{
|
||||||
newFile.Provider = Enum.GetName(_OSSProviderOptions.Provider);
|
newFile.Provider = Enum.GetName(_OSSProviderOptions.Provider);
|
||||||
var filePath = string.Concat(path, "/", finalName);
|
var filePath = string.Concat(path, "/", finalName);
|
||||||
@ -391,7 +391,7 @@ public class SysFileService : IDynamicApiController, ITransient
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (App.Configuration["SSHProvider:IsEnable"].ToBoolean())
|
else if (App.Configuration["SSHProvider:Enabled"].ToBoolean())
|
||||||
{
|
{
|
||||||
var fullPath = string.Concat(path.StartsWith('/') ? path : "/" + path, "/", finalName);
|
var fullPath = string.Concat(path.StartsWith('/') ? path : "/" + path, "/", finalName);
|
||||||
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],
|
using (SSHHelper helper = new SSHHelper(App.Configuration["SSHProvider:Host"],
|
||||||
|
|||||||
@ -68,6 +68,7 @@ public class Startup : AppStartup
|
|||||||
// 任务调度
|
// 任务调度
|
||||||
services.AddSchedule(options =>
|
services.AddSchedule(options =>
|
||||||
{
|
{
|
||||||
|
if(App.GetConfig<bool>("Cache:Redis:AutoDetect", true))
|
||||||
options.AddPersistence<DbJobPersistence>(); // 添加作业持久化器
|
options.AddPersistence<DbJobPersistence>(); // 添加作业持久化器
|
||||||
options.AddMonitor<JobMonitor>(); // 添加作业执行监视器
|
options.AddMonitor<JobMonitor>(); // 添加作业执行监视器
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user