Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
947cd712e1 |
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>3.0.0.2</Version>
|
||||
<Version>3.0.0.3</Version>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
|
||||
<Authors>Diego</Authors>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>3.0.0.2</Version>
|
||||
<Version>3.0.0.3</Version>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<TargetFrameworks>net45;netstandard2.0;net6.0;net7.0</TargetFrameworks>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>3.0.0.2</Version>
|
||||
<Version>3.0.0.3</Version>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>3.0.0.2</Version>
|
||||
<Version>3.0.0.3</Version>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
|
||||
<Authors>Diego</Authors>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Version>3.0.0.2</Version>
|
||||
<Version>3.0.0.3</Version>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
using Furion;
|
||||
using Furion.Schedule;
|
||||
|
||||
namespace ThingsGateway.Admin.Application;
|
||||
@@ -25,7 +26,7 @@ public class LogJob : IJob
|
||||
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
|
||||
{
|
||||
var db = DbContext.Db.CopyNew();
|
||||
var daysAgo = 30; // 删除30天以前
|
||||
var daysAgo = App.GetConfig<int?>("Logging:LogJob:DaysAgo") ?? 30;
|
||||
await db.DeleteableWithAttr<SysVisitLog>().Where(u => u.CreateTime < DateTimeExtensions.CurrentDateTime.AddDays(-daysAgo)).ExecuteCommandAsync(stoppingToken); // 删除访问日志
|
||||
await db.DeleteableWithAttr<SysOperateLog>().Where(u => u.CreateTime < DateTimeExtensions.CurrentDateTime.AddDays(-daysAgo)).ExecuteCommandAsync(stoppingToken); // 删除操作日志
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
#endregion
|
||||
|
||||
using Furion;
|
||||
using Furion.Schedule;
|
||||
|
||||
namespace ThingsGateway.Gateway.Application;
|
||||
@@ -25,7 +26,7 @@ public class BackendAndRpcLogCleanJob : IJob
|
||||
public async Task ExecuteAsync(JobExecutingContext context, CancellationToken stoppingToken)
|
||||
{
|
||||
var db = DbContext.Db.CopyNew();
|
||||
var daysAgo = 30; // 删除30天以前
|
||||
var daysAgo = App.GetConfig<int?>("Logging:LogJob:DaysAgo") ?? 30;
|
||||
await db.DeleteableWithAttr<BackendLog>().Where(u => u.LogTime < DateTimeExtensions.CurrentDateTime.AddDays(-daysAgo)).ExecuteCommandAsync();
|
||||
await db.DeleteableWithAttr<RpcLog>().Where(u => u.LogTime < DateTimeExtensions.CurrentDateTime.AddDays(-daysAgo)).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
@@ -142,6 +142,21 @@ public class CollectDeviceWorker : BackgroundService
|
||||
{
|
||||
CollectDeviceThreads.Remove(devThread);
|
||||
}
|
||||
else
|
||||
{
|
||||
//单个设备重启时,注意同一线程的其他设备也会停止,需要重新初始化
|
||||
foreach (var item in devThread.CollectDeviceCores)
|
||||
{
|
||||
item.Init(item.Device, true);
|
||||
}
|
||||
|
||||
await devThread.StartThreadAsync();
|
||||
|
||||
//如果是组态更改过了,需要重新获取变量/设备运行态的值
|
||||
if (isUpdateDb)
|
||||
await StartOtherHostService();
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -111,17 +111,21 @@ public class HardwareInfoWorker : BackgroundService
|
||||
APPInfo.Environment = App.HostEnvironment.IsDevelopment() ? "Development" : "Production";
|
||||
APPInfo.Stage = App.HostEnvironment.IsStaging() ? "Stage" : "非Stage"; // 是否Stage环境
|
||||
APPInfo.UpdateTime = DateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat();
|
||||
var enable = App.GetConfig<bool?>("HardwareInfo:Enable") ?? true;
|
||||
|
||||
while (!stoppingToken.IsCancellationRequested)
|
||||
{
|
||||
try
|
||||
{
|
||||
APPInfo.UpdateTime = DateTimeExtensions.CurrentDateTime.ToDefaultDateTimeFormat();
|
||||
APPInfo.RemoteIp = await GetIpFromOnlineAsync();
|
||||
|
||||
HardwareInfo?.RefreshMemoryStatus();
|
||||
HardwareInfo?.RefreshMemoryList();
|
||||
HardwareInfo?.RefreshNetworkAdapterList();
|
||||
HardwareInfo?.RefreshCPUList();
|
||||
if (enable)
|
||||
{
|
||||
HardwareInfo?.RefreshMemoryStatus();
|
||||
HardwareInfo?.RefreshMemoryList();
|
||||
HardwareInfo?.RefreshNetworkAdapterList();
|
||||
HardwareInfo?.RefreshCPUList();
|
||||
}
|
||||
//10秒更新一次
|
||||
await Task.Delay(10000, stoppingToken);
|
||||
}
|
||||
|
||||
@@ -159,6 +159,8 @@ public class UploadDeviceWorker : BackgroundService
|
||||
{
|
||||
item.Init(item.Device);
|
||||
}
|
||||
await devThread.StartThreadAsync();
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
{
|
||||
"$schema": "https://gitee.com/dotnetchina/Furion/raw/v4/schemas/v4/furion-schema.json",
|
||||
|
||||
"Urls": "http://*:7200;",
|
||||
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"File": "Information", //程序日志写入文件等级,不包含网关日志
|
||||
"BackendLog": "Information", //网关运行日志存入数据库等级,部署推荐Error
|
||||
"BackendLog": "Information", //网关运行日志存入数据库等级,部署推荐Warning
|
||||
"Default": "Information", //默认等级
|
||||
"Console": "Information", //控制台输出日志等级
|
||||
"Microsoft": "Warning",
|
||||
@@ -12,33 +14,41 @@
|
||||
},
|
||||
"LogEnable": {
|
||||
"File": true //程序日志写入文件
|
||||
},
|
||||
"LogJob": {
|
||||
"DaysAgo": 30 //删除多少天前的日志,任务会间隔24小时执行一次
|
||||
}
|
||||
},
|
||||
//动态API设备
|
||||
"DynamicApiControllerSettings": {
|
||||
"LowercaseRoute": false, //是否采用小写路由,bool 类型,默认 true
|
||||
"KeepName": true, //是否保持原有名称不处理,bool,默认 false
|
||||
"AsLowerCamelCase": true //启用小驼峰命名(首字母小写),默认 false
|
||||
|
||||
"HardwareInfo": {
|
||||
"Enable": true //启用硬件信息获取,部分系统/硬件不支持相关方法,设为false
|
||||
},
|
||||
|
||||
"FriendlyExceptionSettings": {
|
||||
"DefaultErrorMessage": "系统异常,请联系管理员",
|
||||
"HideErrorCode": true
|
||||
},
|
||||
//动态API设备
|
||||
"DynamicApiControllerSettings": {
|
||||
"LowercaseRoute": false, //是否采用小写路由,bool 类型,默认 true
|
||||
"KeepName": true, //是否保持原有名称不处理,bool,默认 false
|
||||
"AsLowerCamelCase": true //启用小驼峰命名(首字母小写),默认 false
|
||||
},
|
||||
|
||||
//排除特定配置文件
|
||||
"IgnoreConfigurationFiles": [
|
||||
"Navs.json",
|
||||
"sys_user.json",
|
||||
"sys_config.json",
|
||||
"sys_relation.json",
|
||||
"sys_resource.json",
|
||||
"sys_role.json",
|
||||
"driver_plugin.json"
|
||||
],
|
||||
"FriendlyExceptionSettings": {
|
||||
"DefaultErrorMessage": "系统异常,请联系管理员",
|
||||
"HideErrorCode": true
|
||||
},
|
||||
|
||||
"CorsAccessorSettings": {
|
||||
"WithExposedHeaders": [ "Content-Disposition" ], // 如果前端不代理且是axios请求
|
||||
"SignalRSupport": true // 启用 SignalR 跨域支持
|
||||
}
|
||||
}
|
||||
//排除特定配置文件
|
||||
"IgnoreConfigurationFiles": [
|
||||
"Navs.json",
|
||||
"sys_user.json",
|
||||
"sys_config.json",
|
||||
"sys_relation.json",
|
||||
"sys_resource.json",
|
||||
"sys_role.json",
|
||||
"driver_plugin.json"
|
||||
],
|
||||
|
||||
"CorsAccessorSettings": {
|
||||
"WithExposedHeaders": [ "Content-Disposition" ], // 如果前端不代理且是axios请求
|
||||
"SignalRSupport": true // 启用 SignalR 跨域支持
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user