Compare commits

...

56 Commits

Author SHA1 Message Date
2248356998 qq.com
605830edce 10.9.62 2025-07-20 21:52:59 +08:00
2248356998 qq.com
ca86441e05 orm性能优化 2025-07-20 19:04:25 +08:00
2248356998 qq.com
b30b876c5f 更新依赖 2025-07-20 10:44:20 +08:00
2248356998 qq.com
f95590b4cb 修正拼写错误 2025-07-19 22:36:13 +08:00
2248356998 qq.com
9921130406 更新依赖 2025-07-19 21:38:19 +08:00
2248356998 qq.com
5c47589ca1 更新依赖 2025-07-19 21:31:46 +08:00
2248356998 qq.com
048abfae2e 添加可空标识 2025-07-19 13:35:55 +08:00
Diego
8e35c16edf 恢复restart标记 2025-07-18 17:46:56 +08:00
Diego
143b751213 Revert "build: 10.9.42"
This reverts commit 2cafe745b9.
2025-07-18 14:41:19 +08:00
Diego
2cafe745b9 build: 10.9.42
feat: 优化读写调度
feat: rpc日志添加执行时间字段
2025-07-18 09:48:41 +08:00
Diego
210ac2c122 更新解决方案 2025-07-18 00:02:38 +08:00
Diego
4707ce6d58 新增RemoteWebApp项目 2025-07-17 23:41:11 +08:00
2248356998 qq.com
788a8b670d 10.9.40 2025-07-16 21:18:14 +08:00
2248356998 qq.com
5e4f0057e4 更新依赖库 2025-07-15 21:24:19 +08:00
2248356998 qq.com
2960c13ef1 更新依赖库 2025-07-15 03:56:46 +08:00
2248356998 qq.com
f11b7f7ab4 10.9.37 2025-07-13 22:47:14 +08:00
Diego
9bb9cd7419 10.9.35 2025-07-11 07:14:52 +08:00
Diego
ba008ef8ba 更新.NETVersion 2025-07-09 13:35:42 +08:00
Diego
28b533decf 10.9.34 2025-07-09 13:31:08 +08:00
Diego
9ee638c2f1 更新依赖包 2025-07-08 23:59:24 +08:00
Diego
d90fdbaf35 补充更新nuget包 2025-07-08 18:15:50 +08:00
Diego
b55e3db736 10.9.29 2025-07-08 17:55:37 +08:00
Diego
dbee8496cb opcuaServer支持decimal类型 2025-07-08 16:53:28 +08:00
Diego
044e78bea9 opcuaserver回退修改 2025-07-08 15:52:12 +08:00
Diego
fe79128d90 build: 10.9.26
fix: opcuaserver添加变量属性出现错误,已回退
refactor: 网关监控树节点保持展开状态
refactor: cache插件类日志输出
2025-07-08 14:33:27 +08:00
Diego
34120da008 ToDecimal方法添加异步捕获,防止double类型值超限 2025-07-08 11:21:06 +08:00
Diego
4c62bb0b21 10.9.25 2025-07-08 10:19:01 +08:00
Diego
46b16279c7 build: 10.9.24 2025-07-08 09:41:45 +08:00
2248356998 qq.com
0779efc5dd refactor: 冗余服务代码修正 2025-07-08 02:38:05 +08:00
Diego
8acdb780e8 nuget本地源创建文件夹 2025-07-07 19:07:08 +08:00
Diego
2e310b919e 添加Keys文件夹 2025-07-07 16:54:58 +08:00
Diego
4155c07269 10.9.23 2025-07-07 15:20:39 +08:00
Diego
32fa833736 build: 10.9.22 2025-07-07 15:10:06 +08:00
Diego
2258f08555 build: 10.9.19 2025-07-07 13:44:19 +08:00
2248356998 qq.com
d90b32f165 refactor: 调整冗余服务代码 2025-07-07 00:15:46 +08:00
2248356998 qq.com
1492377322 refactor:调整部分插件父类 2025-07-06 01:33:15 +08:00
Diego
32eefbf545 build: 10.9.18
feat: 网关监控树节点添加右侧常用操作按钮
2025-07-04 13:54:35 +08:00
Diego
a825ca5f6f 网关监控树节点添加右侧常用操作按钮 2025-07-04 12:50:07 +08:00
Diego
e270b0c4f6 no message 2025-07-04 09:01:31 +08:00
Diego
6ae44ccf58 10.9.17 2025-07-04 08:36:37 +08:00
Diego
1aa0df6339 feat: 支持变量低内存导出 2025-07-03 23:24:56 +08:00
Diego
62c3693dbe 导出通道和设备支持IEnumerable低内存 2025-07-03 19:34:51 +08:00
Diego
e4e503c97b build: 添加nuget.config,自定义nuget源,方便本地调试自行编译 2025-07-03 12:43:51 +08:00
2248356998 qq.com
5ec1ee7627 fix: 上次更新导致大小端配置映射错误 2025-07-02 21:51:00 +08:00
Diego
79789388fc fix: opcuaserver动态刷新变量节点会导致新建的动态节点无法刷新订阅 2025-07-02 19:11:11 +08:00
Diego
2c4194ee18 refactor: opcua某些不存在的节点ID不再影响整体订阅,只出现日志提示 2025-07-02 15:09:52 +08:00
Diego
1b2be585af fix: 报警分析错误设置循环 2025-07-02 14:26:25 +08:00
Diego
83736647e7 feat: S7PLC增加WString支持 2025-07-02 12:49:55 +08:00
Diego
b06405717d build: 10.9.9
fix: timerx 池 max值取消
feat: mqttrpc支持脚本
2025-07-02 10:03:50 +08:00
2248356998 qq.com
298a1f2ed4 更新docker文件 2025-07-02 07:32:23 +08:00
Diego
74a47a1983 build: 10.9.8
支持redis缓存
2025-07-01 17:55:03 +08:00
Diego
a48a42abe4 modbusslave 异常捕获 2025-07-01 10:51:10 +08:00
Diego
feb1d0a3c5 feat: 增加后台服务生命周期识别 2025-06-30 10:59:18 +08:00
Diego
92bca824e6 10.9.6 2025-06-29 22:19:53 +08:00
2248356998 qq.com
025c699517 feat: s7增加请求id识别 2025-06-29 22:06:53 +08:00
2248356998 qq.com
53f8fbe4b1 refactor: 变量排序导出 2025-06-28 21:43:06 +08:00
1073 changed files with 52644 additions and 13727 deletions

View File

@@ -20,7 +20,6 @@ using System.Collections.Concurrent;
using ThingsGateway.Extension;
using ThingsGateway.FriendlyException;
using ThingsGateway.NewLife.Json.Extension;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;

View File

@@ -33,22 +33,22 @@ public static class CacheConst
/// <summary>
/// 资源表缓存Key
/// </summary>
public const string Cache_SysResource = $"{CacheConst.Cache_Prefix_Admin}SysResource:";
public const string Cache_SysResource = $"{CacheConst.Cache_Prefix_Admin}SysResource:List";
/// <summary>
/// 角色表缓存Key
/// </summary>
public const string Cache_SysRole = $"{CacheConst.Cache_Prefix_Admin}SysRole:";
public const string Cache_SysRole = $"{CacheConst.Cache_Prefix_Admin}SysRole:List";
/// <summary>
/// 用户表缓存Key
/// </summary>
public const string Cache_SysUser = $"{CacheConst.Cache_Prefix_Admin}SysUser:";
public const string Cache_SysUser = $"{CacheConst.Cache_Prefix_Admin}SysUser:Hash";
/// <summary>
/// 用户账号关系缓存Key
/// </summary>
public const string Cache_SysUserAccount = $"{CacheConst.Cache_Prefix_Admin}SysUserAccount:";
public const string Cache_SysUserAccount = $"{CacheConst.Cache_Prefix_Admin}SysUserAccount:Hash";
/// <summary>
/// 职位表缓存Key
@@ -58,7 +58,7 @@ public static class CacheConst
/// <summary>
/// 机构表缓存Key
/// </summary>
public const string Cache_SysOrg = $"{CacheConst.Cache_Prefix_Admin}SysOrg:";
public const string Cache_SysOrg = $"{CacheConst.Cache_Prefix_Admin}SysOrg:List";
/// <summary>
/// 公司表缓存Key
@@ -67,12 +67,12 @@ public static class CacheConst
/// <summary>
/// 公司表缓存Key
/// </summary>
public const string Cache_SysOrgTenant = $"{CacheConst.Cache_Prefix_Admin}OrgTenant:";
public const string Cache_SysOrgTenant = $"{CacheConst.Cache_Prefix_Admin}OrgTenant:Hash";
/// <summary>
/// Token表缓存Key
/// </summary>
public const string Cache_Token = $"{CacheConst.Cache_Prefix_Admin}Token:";
public const string Cache_Token = $"{CacheConst.Cache_Prefix_Admin}Token:Hash";
#region

View File

@@ -8,12 +8,8 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using System.ComponentModel.DataAnnotations;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
[SugarTable("sys_dict", TableDescription = "字典表")]

View File

@@ -8,10 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
/// <summary>

View File

@@ -8,12 +8,8 @@
// QQ群605534569
// ------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using System.ComponentModel.DataAnnotations;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
/// <summary>

View File

@@ -8,11 +8,9 @@
// QQ群605534569
// ------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using System.ComponentModel.DataAnnotations;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
/// <summary>

View File

@@ -8,16 +8,12 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using Microsoft.AspNetCore.Components.Routing;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
/// <summary>

View File

@@ -8,12 +8,8 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using System.ComponentModel.DataAnnotations;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
/// <summary>

View File

@@ -8,14 +8,9 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using Riok.Mapperly.Abstractions;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics.CodeAnalysis;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
@@ -175,14 +170,14 @@ public class SysUser : BaseEntity
/// </summary>
[SugarColumn(IsIgnore = true, IsJson = true)]
[AutoGenerateColumn(Ignore = true)]
public List<long> OrgAndPosIdList { get; set; } = new List<long>();
public List<long>? OrgAndPosIdList { get; set; } = new List<long>();
/// <summary>
/// 主管信息
/// </summary>
[SugarColumn(IsIgnore = true)]
[AutoGenerateColumn(Ignore = true)]
public UserSelectorOutput DirectorInfo { get; set; }
public UserSelectorOutput? DirectorInfo { get; set; }
#endregion
@@ -193,35 +188,35 @@ public class SysUser : BaseEntity
/// </summary>
[SugarColumn(IsIgnore = true)]
[AutoGenerateColumn(Ignore = true)]
public Dictionary<string, List<string>> ButtonCodeList { get; set; } = new();
public Dictionary<string, List<string>>? ButtonCodeList { get; set; } = new();
/// <summary>
/// 权限码集合
/// </summary>
[SugarColumn(IsIgnore = true)]
[AutoGenerateColumn(Ignore = true)]
public HashSet<string> PermissionCodeList { get; set; } = new();
public HashSet<string>? PermissionCodeList { get; set; } = new();
/// <summary>
/// 角色ID集合
/// </summary>
[SugarColumn(IsIgnore = true)]
[AutoGenerateColumn(Ignore = true)]
public HashSet<long> RoleIdList { get; set; } = new();
public HashSet<long>? RoleIdList { get; set; } = new();
/// <summary>
/// 机构及以下机构ID集合
/// </summary>
[SugarColumn(IsIgnore = true)]
[AutoGenerateColumn(Ignore = true)]
public HashSet<long> ScopeOrgChildList { get; set; }
public HashSet<long>? ScopeOrgChildList { get; set; }
/// <summary>
/// 模块集合
/// </summary>
[SugarColumn(IsIgnore = true)]
[AutoGenerateColumn(Ignore = true)]
public List<SysResource> ModuleList { get; set; } = new();
public List<SysResource>? ModuleList { get; set; } = new();
/// <summary>
/// 租户Id

View File

@@ -8,10 +8,7 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using ThingsGateway.List;
using ThingsGateway.SqlSugar;
using ThingsGateway.Common.List;
namespace ThingsGateway.Admin.Application;

View File

@@ -8,9 +8,30 @@
// QQ群605534569
//------------------------------------------------------------------------------
global using System;
global using System.Collections.Generic;
global using System.Threading;
global using System.Threading.Tasks;
using ThingsGateway.Extension;
global using ThingsGateway.Gateway.Application;
namespace ThingsGateway.Admin.Application;
/// <inheritdoc/>
[ThingsGateway.DependencyInjection.SuppressSniffer]
public static class SchemeHelper
{
public static string GetOrCreate()
{
var path = "Keys/SchemeKey.txt";
if (File.Exists(path))
{
var data = File.ReadAllText(path);
return data;
}
else
{
var data = DateTime.UtcNow.ToDefaultDateTimeFormat();
Directory.CreateDirectory("Keys");
File.WriteAllText(path, data);
return data;
}
}
}

View File

@@ -79,7 +79,7 @@ public class RequestAuditFilter : IAsyncActionFilter, IOrderedFilter
logData.TimeOperationElapsedMilliseconds = timeOperation.ElapsedMilliseconds;
var resultHttpContext = (resultContext as FilterContext).HttpContext;
var resultHttpContext = (resultContext as Microsoft.AspNetCore.Mvc.Filters.FilterContext).HttpContext;
// 获取 HttpContext 和 HttpRequest 对象
var httpContext = context.HttpContext;

View File

@@ -8,4 +8,15 @@
// QQ群605534569
//------------------------------------------------------------------------------
global using ThingsGateway.NewLife.Extension;
global using BootstrapBlazor.Components;
global using Microsoft.Extensions.Localization;
global using Microsoft.Extensions.Options;
global using System.Diagnostics.CodeAnalysis;
global using System.Globalization;
global using ThingsGateway.Common;
global using ThingsGateway.DB;
global using ThingsGateway.NewLife.Extension;
global using ThingsGateway.SqlSugar;

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using ThingsGateway.NewLife;
namespace ThingsGateway.Admin.Application;

View File

@@ -9,9 +9,7 @@
// ------------------------------------------------------------------------------
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Localization;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Runtime.InteropServices;
@@ -20,7 +18,6 @@ using ThingsGateway.NewLife;
using ThingsGateway.NewLife.Caching;
using ThingsGateway.NewLife.Threading;
using ThingsGateway.Schedule;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
@@ -53,15 +50,15 @@ public class HardwareJob : IJob, IHardwareJob
#endregion
private MemoryCache MemoryCache = new() { };
private const string CacheKey = "HistoryHardwareInfo";
private ICache MemoryCache => App.CacheService;
private const string CacheKey = $"{CacheConst.Cache_HardwareInfo}HistoryHardwareInfo";
/// <inheritdoc/>
public async Task<List<HistoryHardwareInfo>> GetHistoryHardwareInfos()
{
var historyHardwareInfos = MemoryCache.Get<List<HistoryHardwareInfo>>(CacheKey);
if (historyHardwareInfos == null)
{
using var db = DbContext.GetDB<HistoryHardwareInfo>(); ;
using var db = DbContext.GetDB<HistoryHardwareInfo>();
historyHardwareInfos = await db.Queryable<HistoryHardwareInfo>().Where(a => a.Date > DateTime.Now.AddDays(-3)).Take(1000).ToListAsync().ConfigureAwait(false);
MemoryCache.Set(CacheKey, historyHardwareInfos);
@@ -81,8 +78,7 @@ public class HardwareJob : IJob, IHardwareJob
{
if (HardwareInfo.MachineInfo == null)
{
MachineInfo.Register();
HardwareInfo.MachineInfo = MachineInfo.Current;
HardwareInfo.MachineInfo = MachineInfo.GetCurrent();
string currentPath = Directory.GetCurrentDirectory();
DriveInfo drive = new(Path.GetPathRoot(currentPath));
@@ -133,7 +129,7 @@ public class HardwareJob : IJob, IHardwareJob
CpuUsage = (HardwareInfo.MachineInfo.CpuRate * 100).ToInt(),
Temperature = (HardwareInfo.MachineInfo.Temperature).ToInt(),
};
await _db.Insertable(his).ExecuteCommandAsync(stoppingToken).ConfigureAwait(false);
await _db.InsertableT(his).ExecuteCommandAsync(stoppingToken).ConfigureAwait(false);
MemoryCache.Remove(CacheKey);
}
var sevenDaysAgo = TimerX.Now.AddDays(-HardwareInfoOptions.DaysAgo);

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
/// <inheritdoc/>

View File

@@ -15,8 +15,6 @@ using ThingsGateway.Extension;
using ThingsGateway.FriendlyException;
using ThingsGateway.Logging;
using ThingsGateway.NewLife.Json.Extension;
using ThingsGateway.Razor;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using Riok.Mapperly.Abstractions;
namespace ThingsGateway.Admin.Application;

View File

@@ -4,7 +4,6 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System.Collections.Concurrent;
using System.Security.Claims;
@@ -211,7 +210,7 @@ public class AdminOAuthHandler<TOptions>(
using var db = DbContext.GetDB<SysUser>();
//更新用户登录信息
if (await db.Updateable(sysUser).UpdateColumns(it => new
if (await db.UpdateableT(sysUser).UpdateColumns(it => new
{
it.LastLoginIp,
it.LastLoginTime,

View File

@@ -10,7 +10,6 @@
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Http;
using System.Security.Claims;
@@ -116,7 +115,7 @@ public class BlazorAuthenticationHandler : AppAuthorizeHandler
{
// 路由名称
var routeName = routeData.PageType.CustomAttributes.FirstOrDefault(x =>
x.AttributeType == typeof(RouteAttribute))?.ConstructorArguments?[0].Value as string;
x.AttributeType == typeof(Microsoft.AspNetCore.Components.RouteAttribute))?.ConstructorArguments?[0].Value as string;
if (routeName == null) return true;
if ((!user.PermissionCodeList.Contains(routeName.CutStart("/")) && !user.PermissionCodeList.Contains(routeName))) //如果当前路由信息不包含在角色授权路由列表中则认证失败

View File

@@ -11,11 +11,9 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Localization;
using ThingsGateway.DataValidation;
using ThingsGateway.FriendlyException;
using ThingsGateway.Razor;
using ThingsGateway.UnifyResult;
namespace ThingsGateway.Admin.Application;

View File

@@ -9,19 +9,15 @@
// ------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc.ApiExplorer;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.Extensions.Options;
using Swashbuckle.AspNetCore.SwaggerGen;
using System.Globalization;
using System.Reflection;
using ThingsGateway.Extension;
using ThingsGateway.Common.Extension;
namespace ThingsGateway.Admin.Application;

View File

@@ -10,7 +10,6 @@
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Localization;
using System.Security.Claims;
@@ -326,7 +325,7 @@ public class AuthService : IAuthService
using var db = DbContext.GetDB<SysUser>();
//更新用户登录信息
if (await db.Updateable(sysUser).UpdateColumns(it => new
if (await db.UpdateableT(sysUser).UpdateColumns(it => new
{
it.LastLoginIp,
it.LastLoginTime,

View File

@@ -58,7 +58,7 @@ public class LoginOutput
/// <summary>
/// 模块列表
/// </summary>
public IEnumerable<SysResource> ModuleList { get; set; } = Enumerable.Empty<SysResource>();
public IEnumerable<SysResource>? ModuleList { get; set; } = Enumerable.Empty<SysResource>();
/// <summary>
/// 刷新Token

View File

@@ -15,17 +15,17 @@ public class AppConfig
/// <summary>
/// 登录策略
/// </summary>
public LoginPolicy LoginPolicy { get; set; }
public LoginPolicy? LoginPolicy { get; set; }
/// <summary>
/// 页面策略
/// </summary>
public PagePolicy PagePolicy { get; set; }
public PagePolicy? PagePolicy { get; set; }
/// <summary>
/// 密码策略
/// </summary>
public PasswordPolicy PasswordPolicy { get; set; }
public PasswordPolicy? PasswordPolicy { get; set; }
public WebsitePolicy WebsitePolicy { get; set; }
public WebsitePolicy? WebsitePolicy { get; set; }
}

View File

@@ -15,5 +15,5 @@ public class PagePolicy
/// <summary>
/// 系统默认快捷方式菜单ID列表
/// </summary>
public List<long> Shortcuts { get; set; } = new();
public List<long>? Shortcuts { get; set; } = new();
}

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
namespace ThingsGateway.Admin.Application;
/// <summary>

View File

@@ -8,11 +8,8 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using ThingsGateway.FriendlyException;
using ThingsGateway.NewLife.Json.Extension;
using ThingsGateway.Razor;
namespace ThingsGateway.Admin.Application;

View File

@@ -10,6 +10,8 @@
using System.Collections.Concurrent;
using ThingsGateway.NewLife.DictionaryExtensions;
namespace ThingsGateway.Admin.Application;
/// <summary>

View File

@@ -10,7 +10,6 @@
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Localization;
using System.Text;
using System.Web;
@@ -90,7 +89,4 @@ internal sealed class FileService : IFileService
if (!allowTypeS.Contains(fileSuffix)) throw Oops.Bah(_localizer["FileTypeError", fileSuffix]);
}
#region
#endregion
}

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using ThingsGateway.Extension.Generic;
namespace ThingsGateway.Admin.Application;

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
namespace ThingsGateway.Admin.Application;
/// <summary>

View File

@@ -8,12 +8,8 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using System.Data;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
internal sealed class SysOperateLogService : BaseService<SysOperateLog>, ISysOperateLogService

View File

@@ -8,10 +8,6 @@
// QQ群605534569
// ------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
/// <summary>

View File

@@ -8,11 +8,8 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using ThingsGateway.Extension.Generic;
using ThingsGateway.FriendlyException;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;

View File

@@ -8,10 +8,6 @@
// QQ群605534569
// ------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
/// <summary>

View File

@@ -8,10 +8,7 @@
// QQ群605534569
// ------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using ThingsGateway.FriendlyException;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;

View File

@@ -137,7 +137,7 @@ internal sealed class RelationService : BaseService<SysRelation>, IRelationServi
{
if (clear)
await db.Deleteable<SysRelation>().Where(it => it.ObjectId == objectId && it.Category == category).ExecuteCommandAsync().ConfigureAwait(false);//删除老的
await db.Insertable(sysRelation).ExecuteCommandAsync().ConfigureAwait(false);//添加新的
await db.InsertableT(sysRelation).ExecuteCommandAsync().ConfigureAwait(false);//添加新的
}).ConfigureAwait(false);
if (result.IsSuccess)//如果成功了
{

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using System.ComponentModel.DataAnnotations;
using ThingsGateway.Extension.Generic;

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
namespace ThingsGateway.Admin.Application;
/// <summary>

View File

@@ -8,14 +8,9 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using Microsoft.Extensions.DependencyInjection;
using System.Globalization;
using ThingsGateway.FriendlyException;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
@@ -23,7 +18,7 @@ internal sealed class SysResourceService : BaseService<SysResource>, ISysResourc
{
private readonly IRelationService _relationService;
private string CacheKey = $"{CacheConst.Cache_SysResource}-{CultureInfo.CurrentUICulture.Name}";
private string CacheKey = $"{CacheConst.Cache_SysResource}";
public SysResourceService(IRelationService relationService)
{
@@ -32,7 +27,6 @@ internal sealed class SysResourceService : BaseService<SysResource>, ISysResourc
#region
[OperDesc("CopyResource")]
public async Task CopyAsync(IEnumerable<long> ids, long moduleId)
{
@@ -69,7 +63,7 @@ internal sealed class SysResourceService : BaseService<SysResource>, ISysResourc
var resource = resourceList.First(a => a.Id == id);
resource.ParentId = parentMenuId;
using var db = GetDB();
var result = await db.Updateable(resource).ExecuteCommandAsync().ConfigureAwait(false);
var result = await db.UpdateableT(resource).ExecuteCommandAsync().ConfigureAwait(false);
RefreshCache();//刷新缓存
_relationService.RefreshCache(RelationCategoryEnum.RoleHasResource);//关系表刷新缓存
_relationService.RefreshCache(RelationCategoryEnum.UserHasResource);//关系表刷新缓存
@@ -143,12 +137,12 @@ internal sealed class SysResourceService : BaseService<SysResource>, ISysResourc
/// <returns>全部资源列表</returns>
public async Task<List<SysResource>> GetAllAsync()
{
var sysResources = App.CacheService.Get<List<SysResource>>(CacheKey);
var sysResources = App.CacheService.Get<List<SysResource>>(CacheConst.Cache_SysResource);
if (sysResources == null)
{
using var db = GetDB();
sysResources = await db.Queryable<SysResource>().ToListAsync().ConfigureAwait(false);
App.CacheService.Set(CacheKey, sysResources);
App.CacheService.Set(CacheConst.Cache_SysResource, sysResources);
}
return sysResources;
}
@@ -201,7 +195,7 @@ internal sealed class SysResourceService : BaseService<SysResource>, ISysResourc
if (type == ItemChangedType.Add)
{
var result = await db.Insertable(input).ExecuteCommandAsync().ConfigureAwait(false);
var result = await db.InsertableT(input).ExecuteCommandAsync().ConfigureAwait(false);
RefreshCache();//刷新缓存
return result > 0;
}
@@ -226,7 +220,7 @@ internal sealed class SysResourceService : BaseService<SysResource>, ISysResourc
//事务
var result = await db.UseTranAsync(async () =>
{
await db.Updateable(input).ExecuteCommandAsync().ConfigureAwait(false);//更新数据
await db.UpdateableT(input).ExecuteCommandAsync().ConfigureAwait(false);//更新数据
if (permissions.Count > 0)//如果权限列表大于0就更新
{
await db.Updateable(permissions).ExecuteCommandAsync().ConfigureAwait(false);//更新关系表
@@ -258,7 +252,7 @@ internal sealed class SysResourceService : BaseService<SysResource>, ISysResourc
/// </summary>
public void RefreshCache()
{
App.CacheService.Remove(CacheKey);
App.CacheService.Remove(CacheConst.Cache_SysResource);
//删除超级管理员的缓存
App.RootServices.GetRequiredService<ISysUserService>().DeleteUserFromCache(RoleConst.SuperAdminId);
}

View File

@@ -8,10 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
/// <summary>

View File

@@ -8,11 +8,8 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using ThingsGateway.FriendlyException;
using ThingsGateway.NewLife.Json.Extension;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
namespace ThingsGateway.Admin.Application;
/// <summary>

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
namespace ThingsGateway.Admin.Application;
public interface ISessionService

View File

@@ -8,10 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
internal sealed class SessionService : BaseService<SysUser>, ISessionService

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
namespace ThingsGateway.Admin.Application;
/// <summary>

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
namespace ThingsGateway.Admin.Application;
/// <summary>

View File

@@ -8,14 +8,12 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using ThingsGateway.Common.Extension;
using ThingsGateway.Common.Extension.Generic;
using ThingsGateway.DataEncryption;
using ThingsGateway.Extension;
using ThingsGateway.Extension.Generic;
using ThingsGateway.FriendlyException;
using ThingsGateway.NewLife.Json.Extension;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
@@ -472,7 +470,7 @@ internal sealed class SysUserService : BaseService<SysUser>, ISysUserService
var sysUser = input;//实体转换
using var db = GetDB();
var result = await db.Updateable(sysUser).IgnoreColumns(it =>
var result = await db.UpdateableT(sysUser).IgnoreColumns(it =>
new
{
//忽略更新字段

View File

@@ -8,4 +8,3 @@
// QQ群605534569
//------------------------------------------------------------------------------
namespace ThingsGateway.Admin.Application;

View File

@@ -8,16 +8,13 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using System.Text.RegularExpressions;
using ThingsGateway.Common.Extension;
using ThingsGateway.DataEncryption;
using ThingsGateway.Extension;
using ThingsGateway.Extension.Generic;
using ThingsGateway.FriendlyException;
using ThingsGateway.NewLife.Json.Extension;
using ThingsGateway.Razor;
namespace ThingsGateway.Admin.Application;

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;
/// <summary>

View File

@@ -8,13 +8,13 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.Reflection;
using System.Text;
using ThingsGateway.NewLife.Log;
using ThingsGateway.Extension;
using ThingsGateway.UnifyResult;
namespace ThingsGateway.Admin.Application;
@@ -41,7 +41,6 @@ public class Startup : AppStartup
services.AddSingleton<IVerificatInfoService, VerificatInfoService>();
services.AddScoped<IAuthRazorService, AuthRazorService>();
services.AddSingleton<IApiPermissionService, ApiPermissionService>();
services.AddSingleton<IFileService, FileService>();
services.AddSingleton<IImportExportService, ImportExportService>();
@@ -65,11 +64,76 @@ public class Startup : AppStartup
services.AddSingleton(typeof(IEventService<>), typeof(EventService<>));
#region
services.AddConsoleFormatter(options =>
{
options.WriteFilter = (logMsg) =>
{
if (App.HostApplicationLifetime.ApplicationStopping.IsCancellationRequested && logMsg.LogLevel >= LogLevel.Warning) return false;
if (string.IsNullOrEmpty(logMsg.Message)) return false;
else return true;
};
options.MessageFormat = (logMsg) =>
{
//如果不是LoggingMonitor日志才格式化
if (logMsg.LogName != "System.Logging.LoggingMonitor")
{
var stringBuilder = new StringBuilder();
stringBuilder.AppendLine("【日志级别】:" + logMsg.LogLevel);
stringBuilder.AppendLine("【日志类名】:" + logMsg.LogName);
stringBuilder.AppendLine("【日志时间】:" + DateTime.Now.ToDefaultDateTimeFormat());
stringBuilder.AppendLine("【日志内容】:" + logMsg.Message);
if (logMsg.Exception != null)
{
stringBuilder.AppendLine("【异常信息】:" + logMsg.Exception);
}
return stringBuilder.ToString();
}
else
{
return logMsg.Message;
}
};
options.WriteHandler = (logMsg, scopeProvider, writer, fmtMsg, opt) =>
{
ConsoleColor consoleColor = ConsoleColor.White;
switch (logMsg.LogLevel)
{
case LogLevel.Information:
consoleColor = ConsoleColor.DarkGreen;
break;
case LogLevel.Warning:
consoleColor = ConsoleColor.DarkYellow;
break;
case LogLevel.Error:
consoleColor = ConsoleColor.DarkRed;
break;
}
writer.WriteWithColor(fmtMsg, ConsoleColor.Black, consoleColor);
};
});
#endregion
//日志写入数据库配置
services.AddDatabaseLogging<DatabaseLoggingWriter>(options =>
{
options.NameFilter = (name) =>
{
return (
name == "System.Logging.RequestAudit"
);
};
});
}
public void Use(IServiceProvider serviceProvider)
{
XTrace.UnhandledExceptionLogEnable = () => !App.HostApplicationLifetime.ApplicationStopping.IsCancellationRequested;
NewLife.Log.XTrace.UnhandledExceptionLogEnable = () => !App.HostApplicationLifetime.ApplicationStopping.IsCancellationRequested;
//检查ConfigId
var configIdGroup = DbContext.DbConfigs.GroupBy(it => it.ConfigId);

View File

@@ -21,7 +21,7 @@ namespace ThingsGateway.Admin.Application
Settings = new UserAgentSettings();
}
private MemoryCache MemoryCache { get; set; } = new();
private ICache MemoryCache => App.CacheService;
/// <summary>
/// Parses the specified user agent string.

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using ThingsGateway.NewLife;
namespace ThingsGateway.Admin.Application;

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
namespace ThingsGateway.Admin.Application;
/// <inheritdoc/>

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
namespace ThingsGateway.Admin.Application;
/// <inheritdoc/>
@@ -26,8 +24,6 @@ public static class OrgUtil
var data = items
.Select((item, index) =>
new SelectedItem(item.Id.ToString(), item.Name)
{
}
).ToList();
return data;
}

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
namespace ThingsGateway.Admin.Application;
/// <inheritdoc/>

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
namespace ThingsGateway.Admin.Application;
/// <inheritdoc/>

View File

@@ -8,8 +8,6 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
namespace ThingsGateway.Admin.Application;
/// <inheritdoc/>
@@ -27,8 +25,6 @@ public static class UserUtil
var data = items
.Select((item, index) =>
new SelectedItem(item.Id.ToString(), item.Account)
{
}
).ToList();
return data;
}

View File

@@ -9,7 +9,6 @@
//------------------------------------------------------------------------------
using ThingsGateway.Extension.Generic;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Application;

View File

@@ -9,7 +9,6 @@
//------------------------------------------------------------------------------
using ThingsGateway.Admin.Application;
using ThingsGateway.NewLife.Extension;
namespace ThingsGateway.Admin.Razor;

View File

@@ -55,7 +55,7 @@ public partial class SysSignalRLoginConnectionHub : ComponentBase, IAsyncDisposa
return true;
};
}
;
return message;
};
foreach (var item in App.User?.Claims ?? new List<Claim>())

View File

@@ -10,7 +10,6 @@
using ThingsGateway.Admin.Application;
using ThingsGateway.NewLife;
using ThingsGateway.NewLife.Extension;
namespace ThingsGateway.Admin.Razor;

View File

@@ -16,7 +16,10 @@ global using Microsoft.Extensions.Options;
global using System.Diagnostics.CodeAnalysis;
global using ThingsGateway.Common;
global using ThingsGateway.DB;
global using ThingsGateway.NewLife.Extension;
global using ThingsGateway.Razor;
global using ThingsGateway.SqlSugar;
[assembly: SuppressMessage("Reliability", "CA2007", Justification = "<挂起>", Scope = "module")]
[assembly: GlobalGenerateSetParametersAsync(true)]

View File

@@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Components.Forms;
using ThingsGateway.Admin.Application;
using ThingsGateway.Extension.Generic;
using ThingsGateway.NewLife.Extension;
namespace ThingsGateway.Admin.Razor;

View File

@@ -90,8 +90,8 @@
<h6> @((100 - (availableMemory * 100.00 / memory)).ToString("F2") + " %") </h6>
<span> @Localizer["WorkingSet"] <i> @(HardwareJob.HardwareInfo.WorkingSet + " MB")</i></span>
<span> @Localizer["AvailableMemory"] <i> @((availableMemory / 1024.00 / 1024 / 1024).ToString("F2") + " GB")</i></span>
<span> @Localizer["TotalMemory"] <i> @((memory / 1024.00 / 1024 / 1024).ToString("F2") + " GB")</i></span>
<span> @Localizer["AvailableMemory"] <i> @((availableMemory / 1024.00 / 1024).ToString("F2") + " GB")</i></span>
<span> @Localizer["TotalMemory"] <i> @((memory / 1024.00 / 1024).ToString("F2") + " GB")</i></span>
</div>
</Circle>

View File

@@ -9,8 +9,6 @@
//------------------------------------------------------------------------------
using ThingsGateway.Admin.Application;
using ThingsGateway.NewLife.Extension;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Razor;
@@ -49,7 +47,7 @@ public partial class OrgTree : IDisposable
private List<TreeViewItem<SysOrg>> ZItem;
protected override async Task OnInitializedAsync()
{
ZItem = new List<TreeViewItem<SysOrg>>() {new TreeViewItem<SysOrg>(new SysOrg(){ })
ZItem = new List<TreeViewItem<SysOrg>>() {new TreeViewItem<SysOrg>(new SysOrg())
{
Text = AdminLocalizer["All"],
IsActive = Value == 0,

View File

@@ -9,7 +9,6 @@
//------------------------------------------------------------------------------
using ThingsGateway.Admin.Application;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Razor;

View File

@@ -9,8 +9,6 @@
//------------------------------------------------------------------------------
using ThingsGateway.Admin.Application;
using ThingsGateway.NewLife.Extension;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Razor;

View File

@@ -9,8 +9,6 @@
//------------------------------------------------------------------------------
using ThingsGateway.Admin.Application;
using ThingsGateway.NewLife.Extension;
using ThingsGateway.SqlSugar;
namespace ThingsGateway.Admin.Razor;

View File

@@ -10,7 +10,6 @@
using ThingsGateway.Admin.Application;
using ThingsGateway.Extension.Generic;
using ThingsGateway.NewLife.Extension;
namespace ThingsGateway.Admin.Razor;

View File

@@ -9,7 +9,6 @@
//------------------------------------------------------------------------------
using ThingsGateway.Admin.Application;
using ThingsGateway.NewLife.Extension;
namespace ThingsGateway.Admin.Razor;

View File

@@ -11,7 +11,6 @@
using Microsoft.AspNetCore.Components.Forms;
using ThingsGateway.Admin.Application;
using ThingsGateway.NewLife.Extension;
namespace ThingsGateway.Admin.Razor;
@@ -36,7 +35,7 @@ public partial class SysUserEdit
protected override async Task OnInitializedAsync()
{
BoolItems = LocalizerUtil.GetBoolItems(Model.GetType(), nameof(Model.Status));
var items = await SysPositionService.SelectorAsync(new PositionSelectorInput() { });
var items = await SysPositionService.SelectorAsync(new PositionSelectorInput());
Items = PositionUtil.BuildCascaderItemList(items);
ModuleSelectedItems = ResourceUtil.BuildModuleSelectList((await SysResourceService.GetAllAsync())).ToList();
await InvokeAsync(StateHasChanged);

View File

@@ -9,7 +9,6 @@
//------------------------------------------------------------------------------
using ThingsGateway.Admin.Application;
using ThingsGateway.NewLife.Extension;
namespace ThingsGateway.Admin.Razor;

View File

@@ -8,13 +8,11 @@
// QQ群605534569
//------------------------------------------------------------------------------
using BootstrapBlazor.Components;
using ThingsGateway.Admin.Application;
using ThingsGateway.NewLife.Json.Extension;
using ThingsGateway.Razor;
namespace ThingsGateway.Admin.Application;
namespace ThingsGateway.Admin.Razor;
internal sealed class AuthRazorService : IAuthRazorService
{

View File

@@ -8,9 +8,9 @@
// QQ群605534569
//------------------------------------------------------------------------------
using ThingsGateway.Razor;
using ThingsGateway.Admin.Application;
namespace ThingsGateway.Admin.Application;
namespace ThingsGateway.Admin.Razor;
public class HybridAuthRazorService : IAuthRazorService

View File

@@ -8,9 +8,9 @@
// QQ群605534569
//------------------------------------------------------------------------------
using ThingsGateway.Razor;
using ThingsGateway.Admin.Application;
namespace ThingsGateway.Admin.Application;
namespace ThingsGateway.Admin.Razor;
public interface IAuthRazorService
{

View File

@@ -18,6 +18,7 @@ public class Startup : AppStartup
public void Configure(IServiceCollection services)
{
services.AddScoped<IMenuService, MenuService>();
services.AddScoped<IAuthRazorService, AuthRazorService>();
services.AddBootstrapBlazorTableExportService();
}
}

View File

@@ -37,6 +37,7 @@
<ItemGroup>
<ProjectReference Include="..\BlazorSetParametersAsyncGenerator\BlazorSetParametersAsyncGenerator.csproj" PrivateAssets="all" OutputItemType="Analyzer" />
<ProjectReference Include="..\ThingsGateway.Razor\ThingsGateway.Razor.csproj" />
</ItemGroup>
</Project>

View File

@@ -27,8 +27,6 @@ public static class ResourceUtil
var data = items.Where(a => a.Category == ResourceCategoryEnum.Menu)
.Select((item, index) =>
new SelectedItem(item.Id.ToString(), item.Title)
{
}
).ToList();
return data;
}

View File

@@ -15,5 +15,5 @@
@using BootstrapBlazor.Components
@using ThingsGateway.Common.Extension;
@using ThingsGateway.Razor;

View File

@@ -14,6 +14,7 @@
"ThingsGateway.SqlSugar",
"ThingsGateway.Admin.Application",
"ThingsGateway.Admin.Razor",
"ThingsGateway.Common",
"ThingsGateway.DB",
"ThingsGateway.Razor"
]

View File

@@ -14,6 +14,7 @@
"ThingsGateway.SqlSugar",
"ThingsGateway.Admin.Application",
"ThingsGateway.Admin.Razor",
"ThingsGateway.Common",
"ThingsGateway.DB",
"ThingsGateway.Razor"
]

View File

@@ -0,0 +1,22 @@
{
"Cache": {
"CacheType": "Memory", // 可选Memory 或 Redis
"MemoryCacheOptions": {
"Expire": 3600,
"Capacity": 100000,
"Period": 60
},
"RedisCacheOptions": {
"InstanceName": "ThingsGateway",
"Configuration": "server=127.0.0.1:6379;password=123456;db=3;timeout=3000",
"Server": "127.0.0.1:6379",
"Db": 3,
"UserName": "",
"Password": "123456",
"Timeout": 3000,
"Prefix": "ThingsGateway:"
}
}
}

View File

@@ -6,6 +6,7 @@
@using ThingsGateway.Admin.Razor
@using ThingsGateway.Extension;
@using ThingsGateway.Razor
@using ThingsGateway.Common.Extension;
<div class="login h-100">
@* 左侧说明 *@

View File

@@ -19,6 +19,8 @@ using Microsoft.Extensions.Options;
using System.Diagnostics.CodeAnalysis;
using ThingsGateway.Admin.Application;
using ThingsGateway.Admin.Razor;
using ThingsGateway.Common;
using ThingsGateway.DataEncryption;
using ThingsGateway.NewLife.Extension;
using ThingsGateway.Razor;

View File

@@ -17,9 +17,11 @@
@using Microsoft.AspNetCore.Authorization
@using Microsoft.AspNetCore.Components.Authorization
@using Microsoft.Extensions.Localization
@using ThingsGateway.Common.Extension;
@using System.ComponentModel
@using System.ComponentModel.DataAnnotations
@using ThingsGateway.DB;
@inject NavigationManager NavigationManager

View File

@@ -19,6 +19,7 @@ using System.Diagnostics.CodeAnalysis;
using ThingsGateway.Admin.Application;
using ThingsGateway.Admin.Razor;
using ThingsGateway.Common;
using ThingsGateway.Razor;
namespace ThingsGateway.AdminServer;
@@ -78,9 +79,7 @@ public partial class MainLayout : IDisposable
IsScrolling = false,
Title = Localizer["UserCenter"],
ShowFooter = false,
Component = BootstrapDynamicComponent.CreateComponent<UserCenterPage>(new Dictionary<string, object?>()
{
})
Component = BootstrapDynamicComponent.CreateComponent<UserCenterPage>(new Dictionary<string, object?>())
});
}

View File

@@ -13,6 +13,8 @@ using Microsoft.AspNetCore.ResponseCompression;
using System.Runtime.InteropServices;
using System.Text;
using ThingsGateway.Admin.Application;
using ThingsGateway.DB;
using ThingsGateway.NewLife.Log;
namespace ThingsGateway.AdminServer;
@@ -29,6 +31,8 @@ public class Program
// 增加中文编码支持
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
ClaimConst.Scheme = $"{typeof(Program).Assembly.GetName().Name}{SchemeHelper.GetOrCreate()}";
#region Logo
Console.Write(Environment.NewLine);

View File

@@ -40,6 +40,7 @@ public class SingleFilePublish : ISingleFilePublish
"ThingsGateway.NewLife.X",
"ThingsGateway.Razor",
"ThingsGateway.Admin.Razor" ,
"ThingsGateway.Common",
"ThingsGateway.DB",
"ThingsGateway.Admin.Application",
"ThingsGateway.SqlSugar",

View File

@@ -21,14 +21,12 @@ using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Text.Encodings.Web;
using System.Text.Unicode;
using ThingsGateway.Admin.Application;
using ThingsGateway.Admin.Razor;
using ThingsGateway.Extension;
using ThingsGateway.NewLife.Caching;
using ThingsGateway.DB;
using ThingsGateway.VirtualFileServer;
namespace ThingsGateway.AdminServer;
@@ -61,8 +59,6 @@ public class Startup : AppStartup
options.AddPersistence<JobPersistence>();
});
// 缓存
services.AddSingleton<ICache, MemoryCache>();
// 允许跨域
services.AddCorsAccessor();
@@ -86,7 +82,7 @@ public class Startup : AppStartup
// setting.DateParseHandling = DateParseHandling.None; // 解决DateTimeOffset异常
// setting.Converters.Add(new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal }); // 解决DateTimeOffset异常
}
;
services.AddMvcFilter<RequestAuditFilter>();
services.AddControllers()
@@ -112,7 +108,7 @@ public class Startup : AppStartup
.AddHubOptions(options =>
{
//单个传入集线器消息的最大大小。默认 32 KB
options.MaximumReceiveMessageSize = 1024 * 1024;
options.MaximumReceiveMessageSize = 32 * 1024 * 1024;
//可为客户端上载流缓冲的最大项数。 如果达到此限制,则会阻止处理调用,直到服务器处理流项。
options.StreamBufferCapacity = 30;
options.ClientTimeoutInterval = TimeSpan.FromMinutes(2);
@@ -131,7 +127,7 @@ public class Startup : AppStartup
}).AddHubOptions(options =>
{
//单个传入集线器消息的最大大小。默认 32 KB
options.MaximumReceiveMessageSize = 1024 * 1024;
options.MaximumReceiveMessageSize = 32 * 1024 * 1024;
//可为客户端上载流缓冲的最大项数。 如果达到此限制,则会阻止处理调用,直到服务器处理流项。
options.StreamBufferCapacity = 30;
options.ClientTimeoutInterval = TimeSpan.FromMinutes(2);
@@ -153,101 +149,9 @@ public class Startup : AppStartup
#region
services.AddConsoleFormatter(options =>
{
options.WriteFilter = (logMsg) =>
{
if (App.HostApplicationLifetime.ApplicationStopping.IsCancellationRequested && logMsg.LogLevel >= LogLevel.Warning) return false;
if (string.IsNullOrEmpty(logMsg.Message)) return false;
else return true;
};
options.MessageFormat = (logMsg) =>
{
//如果不是LoggingMonitor日志才格式化
if (logMsg.LogName != "System.Logging.LoggingMonitor")
{
var stringBuilder = new StringBuilder();
stringBuilder.AppendLine("【日志级别】:" + logMsg.LogLevel);
stringBuilder.AppendLine("【日志类名】:" + logMsg.LogName);
stringBuilder.AppendLine("【日志时间】:" + DateTime.Now.ToDefaultDateTimeFormat());
stringBuilder.AppendLine("【日志内容】:" + logMsg.Message);
if (logMsg.Exception != null)
{
stringBuilder.AppendLine("【异常信息】:" + logMsg.Exception);
}
return stringBuilder.ToString();
}
else
{
return logMsg.Message;
}
};
options.WriteHandler = (logMsg, scopeProvider, writer, fmtMsg, opt) =>
{
ConsoleColor consoleColor = ConsoleColor.White;
switch (logMsg.LogLevel)
{
case LogLevel.Information:
consoleColor = ConsoleColor.DarkGreen;
break;
case LogLevel.Warning:
consoleColor = ConsoleColor.DarkYellow;
break;
case LogLevel.Error:
consoleColor = ConsoleColor.DarkRed;
break;
}
writer.WriteWithColor(fmtMsg, ConsoleColor.Black, consoleColor);
};
});
#endregion
#region api日志
//Monitor日志配置
//services.AddMonitorLogging(options =>
//{
// options.JsonIndented = true;// 是否美化 JSON
// options.GlobalEnabled = false;//全局启用
// options.ConfigureLogger((logger, logContext, context) =>
// {
// var httpContext = context.HttpContext;//获取httpContext
// //获取客户端信息
// var client = App.GetService<IAppService>().UserAgent;
// // 获取控制器/操作描述器
// var controllerActionDescriptor = context.ActionDescriptor as ControllerActionDescriptor;
// //操作名称默认是控制器名加方法名,自定义操作名称要在action上加Description特性
// var option = $"{controllerActionDescriptor.ControllerName}/{controllerActionDescriptor.ActionName}";
// var desc = App.CreateLocalizerByType(controllerActionDescriptor.ControllerTypeInfo.AsType())[controllerActionDescriptor.MethodInfo.Name];
// //获取特性
// option = desc.Value;//则将操作名称赋值为控制器上写的title
// logContext.Set(LoggingConst.CateGory, option);//传操作名称
// logContext.Set(LoggingConst.Operation, option);//传操作名称
// logContext.Set(LoggingConst.Client, client);//客户端信息
// logContext.Set(LoggingConst.Path, httpContext.Request.Path.Value);//请求地址
// logContext.Set(LoggingConst.Method, httpContext.Request.Method);//请求方法
// });
//});
//日志写入数据库配置
services.AddDatabaseLogging<DatabaseLoggingWriter>(options =>
{
options.WriteFilter = (logMsg) =>
{
return logMsg.LogName == "System.Logging.RequestAudit";
};
});
#endregion api日志
//已添加AddOptions
// 增加多语言支持配置信息
@@ -302,7 +206,7 @@ public class Startup : AppStartup
var certificate = new X509Certificate2("ThingsGateway.pfx", "ThingsGateway", X509KeyStorageFlags.EphemeralKeySet);
#endif
services.AddDataProtection()
.PersistKeysToFileSystem(new DirectoryInfo("keys"))
.PersistKeysToFileSystem(new DirectoryInfo("Keys"))
.ProtectKeysWithCertificate(certificate)
.UseCryptographicAlgorithms(new AuthenticatedEncryptorConfiguration
{

View File

@@ -7,7 +7,7 @@
<TargetFrameworks>net8.0;net9.0;</TargetFrameworks>
</PropertyGroup>
<Import Project="Admin.targets" Condition=" '$(Configuration)' != 'Debug' " />
<!--<Import Project="Admin.targets" Condition=" '$(Configuration)' != 'Debug' " />-->
<PropertyGroup>
<OpenApiGenerateDocuments>false</OpenApiGenerateDocuments>
<SatelliteResourceLanguages>zh-Hans;en-US</SatelliteResourceLanguages>
@@ -26,7 +26,7 @@
<!--<PlatformTarget>x86</PlatformTarget>-->
</PropertyGroup>
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<ItemGroup>
<ProjectReference Include="..\ThingsGateway.Admin.Razor\ThingsGateway.Admin.Razor.csproj" />
</ItemGroup>

View File

@@ -8,7 +8,7 @@
// QQ群605534569
//------------------------------------------------------------------------------
namespace ThingsGateway.Admin.Application;
namespace ThingsGateway.Common;
/// <summary>
/// 忽略Excel导入导出

View File

@@ -8,7 +8,7 @@
// QQ群605534569
//------------------------------------------------------------------------------
namespace ThingsGateway.Admin.Application;
namespace ThingsGateway.Common;
/// <summary>
/// 种子数据忽略新增

View File

@@ -10,13 +10,12 @@
using System.Collections;
namespace ThingsGateway.List;
namespace ThingsGateway.Common.List;
/// <summary>
/// 线程安全的List其基本操作和List一致。
/// </summary>
/// <typeparam name="T"></typeparam>
[ThingsGateway.DependencyInjection.SuppressSniffer]
public class ConcurrentList<T> : IList<T>, IReadOnlyList<T>
{
private readonly List<T> m_list;

View File

@@ -12,7 +12,7 @@
//using System.Text;
//namespace ThingsGateway.Razor;
//namespace ThingsGateway.Common;
///// <summary>
///// <see cref="Encoding"/> Master规则

View File

@@ -8,7 +8,7 @@
// QQ群605534569
//------------------------------------------------------------------------------
namespace ThingsGateway.Razor;
namespace ThingsGateway.Common;
public interface IDriverUIBase
{

View File

@@ -8,9 +8,9 @@
// QQ群605534569
//------------------------------------------------------------------------------
using ThingsGateway.List;
using ThingsGateway.Common.List;
namespace ThingsGateway;
namespace ThingsGateway.Common;
/// <summary>
/// 文件导入通用输出
@@ -44,3 +44,14 @@ public class ImportPreviewOutput<T> : ImportPreviewOutputBase where T : class
/// </summary>
public Dictionary<string, T> Data { get; set; } = new();
}
/// <summary>
/// 导入预览
/// </summary>
/// <typeparam name="T"></typeparam>
public class ImportPreviewListOutput<T> : ImportPreviewOutputBase where T : class
{
/// <summary>
/// 数据
/// </summary>
public List<T> Data { get; set; } = new();
}

Some files were not shown because too many files have changed in this diff Show More