Compare commits

...

20 Commits

Author SHA1 Message Date
Kimdiego2098
c6aec3a1af 更新版本号 2023-11-22 14:06:52 +08:00
Kimdiego2098
22e30f7a62 代码文件编码更改 2023-11-22 14:02:41 +08:00
Kimdiego2098
57711b8ab5 修复变量上传属性在编辑页面不显示的问题 2023-11-22 13:35:44 +08:00
Kimdiego2098
90ff1259ea 修复变量上传属性在编辑页面不显示的问题 2023-11-22 13:30:42 +08:00
Kimdiego2098
d88fc5ccd7 去除不存在的菜单 2023-11-21 18:19:14 +08:00
Kimdiego2098
5aaca2aa9c 调整循环延时时间限值 2023-11-21 16:27:11 +08:00
Kimdiego2098
8b9ca56e17 调试mqtt依赖 2023-11-21 15:07:07 +08:00
Kimdiego2098
e4f3772e6d 去除上传间隔1s限制 2023-11-21 11:46:33 +08:00
Kimdiego2098
d58ec81d20 整理代码 2023-11-21 11:41:44 +08:00
Kimdiego2098
415aae44b6 更新依赖 2023-11-21 08:44:47 +08:00
Kimdiego2098
a533286658 更新版本号 2023-11-20 23:05:12 +08:00
Kimdiego2098
e59f91cd82 去除treeview 2023-11-20 23:04:54 +08:00
Kimdiego2098
5f8b85d8a4 去除treeview显示 2023-11-20 22:53:34 +08:00
Kimdiego2098
47c7b88436 更新版本号 2023-11-20 22:47:18 +08:00
Kimdiego2098
90006782f2 mqttserver/client插件支持websocket通道,直接对接前端 2023-11-20 22:42:08 +08:00
Kimdiego2098
c3d49cbe70 mqttserver/client插件支持websocket通道,直接对接前端 2023-11-20 22:33:26 +08:00
Kimdiego2098
112323a360 modbusTcpServer最大连接数设为3w 2023-11-20 19:46:07 +08:00
Kimdiego2098
9d08c90fda 更新依赖 2023-11-20 17:35:42 +08:00
Kimdiego2098
602d24deec 添加admin-解决方案 2023-11-20 15:38:33 +08:00
Kimdiego2098
a2b9f66785 修复设备curd服务aop失效的问题 2023-11-19 23:30:11 +08:00
50 changed files with 323 additions and 154 deletions

View File

@@ -0,0 +1,101 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33927.249
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "admin", "admin", "{4E66C22C-0636-4949-BF6A-9E3BBE1550BA}"
ProjectSection(SolutionItems) = preProject
admin\Directory.Build.props = admin\Directory.Build.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThingsGateway.Components", "admin\ThingsGateway.Components\ThingsGateway.Components.csproj", "{0A891D8E-23B3-46AD-8D30-565EE5004F93}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThingsGateway.Core", "admin\ThingsGateway.Core\ThingsGateway.Core.csproj", "{A712EAEE-94F2-4F01-8C1C-2EC802280DD7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThingsGateway.Admin.Core", "admin\ThingsGateway.Admin.Core\ThingsGateway.Admin.Core.csproj", "{5DA3D2BD-6768-4479-B52F-49E022EFF310}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThingsGateway.Admin.Blazor", "admin\ThingsGateway.Admin.Blazor\ThingsGateway.Admin.Blazor.csproj", "{8DD5DF98-7FDE-4B49-8661-AEB44D923CFE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThingsGateway.Admin.Application", "admin\ThingsGateway.Admin.Application\ThingsGateway.Admin.Application.csproj", "{D6685A42-2712-417A-92C5-5EFF90B9FA94}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThingsGateway.Admin.ApiController", "admin\ThingsGateway.Admin.ApiController\ThingsGateway.Admin.ApiController.csproj", "{0D17D801-6DAA-4FD1-9A99-F9F07FA6BA88}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "web", "web", "{F0C9A8CB-231B-45E0-B91B-4FEF7EF47197}"
ProjectSection(SolutionItems) = preProject
web\Directory.Build.props = web\Directory.Build.props
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThingsGateway.Web.Core", "web\ThingsGateway.Web.Core\ThingsGateway.Web.Core.csproj", "{D37EC028-EA46-4510-8261-6E780A906314}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThingsGateway.Web.Entry", "web\ThingsGateway.Web.Entry\ThingsGateway.Web.Entry.csproj", "{C5F662EB-991F-438D-BF61-EF87E7371C04}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决方案项", "{97B23D8B-C6C0-4746-A21F-C7B49354B284}"
ProjectSection(SolutionItems) = preProject
..\.gitignore = ..\.gitignore
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThingsGateway.Foundation", "foundation\ThingsGateway.Foundation\ThingsGateway.Foundation.csproj", "{6961511A-8787-42AF-827D-B630B2AF4791}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "foundation", "foundation", "{268A1A81-2685-47E1-9986-5934A58A31A4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0A891D8E-23B3-46AD-8D30-565EE5004F93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A891D8E-23B3-46AD-8D30-565EE5004F93}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A891D8E-23B3-46AD-8D30-565EE5004F93}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A891D8E-23B3-46AD-8D30-565EE5004F93}.Release|Any CPU.Build.0 = Release|Any CPU
{A712EAEE-94F2-4F01-8C1C-2EC802280DD7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A712EAEE-94F2-4F01-8C1C-2EC802280DD7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A712EAEE-94F2-4F01-8C1C-2EC802280DD7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A712EAEE-94F2-4F01-8C1C-2EC802280DD7}.Release|Any CPU.Build.0 = Release|Any CPU
{5DA3D2BD-6768-4479-B52F-49E022EFF310}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5DA3D2BD-6768-4479-B52F-49E022EFF310}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DA3D2BD-6768-4479-B52F-49E022EFF310}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DA3D2BD-6768-4479-B52F-49E022EFF310}.Release|Any CPU.Build.0 = Release|Any CPU
{8DD5DF98-7FDE-4B49-8661-AEB44D923CFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8DD5DF98-7FDE-4B49-8661-AEB44D923CFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8DD5DF98-7FDE-4B49-8661-AEB44D923CFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8DD5DF98-7FDE-4B49-8661-AEB44D923CFE}.Release|Any CPU.Build.0 = Release|Any CPU
{D6685A42-2712-417A-92C5-5EFF90B9FA94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D6685A42-2712-417A-92C5-5EFF90B9FA94}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D6685A42-2712-417A-92C5-5EFF90B9FA94}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D6685A42-2712-417A-92C5-5EFF90B9FA94}.Release|Any CPU.Build.0 = Release|Any CPU
{0D17D801-6DAA-4FD1-9A99-F9F07FA6BA88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0D17D801-6DAA-4FD1-9A99-F9F07FA6BA88}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0D17D801-6DAA-4FD1-9A99-F9F07FA6BA88}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0D17D801-6DAA-4FD1-9A99-F9F07FA6BA88}.Release|Any CPU.Build.0 = Release|Any CPU
{D37EC028-EA46-4510-8261-6E780A906314}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D37EC028-EA46-4510-8261-6E780A906314}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D37EC028-EA46-4510-8261-6E780A906314}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D37EC028-EA46-4510-8261-6E780A906314}.Release|Any CPU.Build.0 = Release|Any CPU
{C5F662EB-991F-438D-BF61-EF87E7371C04}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C5F662EB-991F-438D-BF61-EF87E7371C04}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C5F662EB-991F-438D-BF61-EF87E7371C04}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C5F662EB-991F-438D-BF61-EF87E7371C04}.Release|Any CPU.Build.0 = Release|Any CPU
{6961511A-8787-42AF-827D-B630B2AF4791}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6961511A-8787-42AF-827D-B630B2AF4791}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6961511A-8787-42AF-827D-B630B2AF4791}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6961511A-8787-42AF-827D-B630B2AF4791}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{0A891D8E-23B3-46AD-8D30-565EE5004F93} = {4E66C22C-0636-4949-BF6A-9E3BBE1550BA}
{A712EAEE-94F2-4F01-8C1C-2EC802280DD7} = {4E66C22C-0636-4949-BF6A-9E3BBE1550BA}
{5DA3D2BD-6768-4479-B52F-49E022EFF310} = {4E66C22C-0636-4949-BF6A-9E3BBE1550BA}
{8DD5DF98-7FDE-4B49-8661-AEB44D923CFE} = {4E66C22C-0636-4949-BF6A-9E3BBE1550BA}
{D6685A42-2712-417A-92C5-5EFF90B9FA94} = {4E66C22C-0636-4949-BF6A-9E3BBE1550BA}
{0D17D801-6DAA-4FD1-9A99-F9F07FA6BA88} = {4E66C22C-0636-4949-BF6A-9E3BBE1550BA}
{D37EC028-EA46-4510-8261-6E780A906314} = {F0C9A8CB-231B-45E0-B91B-4FEF7EF47197}
{C5F662EB-991F-438D-BF61-EF87E7371C04} = {F0C9A8CB-231B-45E0-B91B-4FEF7EF47197}
{6961511A-8787-42AF-827D-B630B2AF4791} = {268A1A81-2685-47E1-9986-5934A58A31A4}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C49B2D3E-6818-4E28-91B7-6E4E7E264BBB}
EndGlobalSection
EndGlobal

View File

@@ -82,6 +82,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决方案项", "{97B23D8B-C6C0-4746-A21F-C7B49354B284}"
ProjectSection(SolutionItems) = preProject
..\.gitignore = ..\.gitignore
..\README.md = ..\README.md
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ThingsGateway.Plugin.Kafka", "plugin\ThingsGateway.Plugin.Kafka\ThingsGateway.Plugin.Kafka.csproj", "{E4B8B8E6-FAE7-43BA-9A51-33A3CD9FB825}"

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<ImplicitUsings>enable</ImplicitUsings>
<TargetFrameworks>net6.0;net8.0;</TargetFrameworks>
<Version>4.0.0.1</Version>
<Version>4.0.0.4</Version>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Authors>Diego</Authors>

View File

@@ -12,7 +12,7 @@
<ItemGroup>
<ProjectReference Include="..\ThingsGateway.Admin.Core\ThingsGateway.Admin.Core.csproj" />
<PackageReference Include="MiniExcel" Version="1.31.2" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.5" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.7" />
</ItemGroup>
</Project>

View File

@@ -1,12 +1,12 @@
#region copyright
#region copyright
//------------------------------------------------------------------------------
// <EFBFBD>˴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊȫ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <EFBFBD>˴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߱<EFBFBD><EFBFBD><EFBFBD>Diego<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD><EFBFBD>Ŀ<EFBFBD>ԴЭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD>
// GiteeԴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ⣺https://gitee.com/diego2098/ThingsGateway
// GithubԴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ⣺https://github.com/kimdiego2098/ThingsGateway
// ʹ<EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD>https://diego2098.gitee.io/thingsgateway-docs/
// QQȺ<EFBFBD><EFBFBD>605534569
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权(除特别声明外的代码)归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库:https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库:https://github.com/kimdiego2098/ThingsGateway
// 使用文档:https://diego2098.gitee.io/thingsgateway-docs/
// QQ群:605534569
//------------------------------------------------------------------------------
#endregion
@@ -16,8 +16,7 @@ using Masa.Blazor.Presets;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.Extensions.DependencyInjection;
using System.Diagnostics;
using Microsoft.Extensions.Hosting;
using ThingsGateway.Foundation.Extension.String;
@@ -44,7 +43,7 @@ public partial class Login
/// <inheritdoc/>
protected override async Task OnParametersSetAsync()
{
if (Debugger.IsAttached)
if (App.WebHostEnvironment.IsDevelopment())
{
_loginModel.Account = "superAdmin";
_password = "111111";
@@ -54,7 +53,7 @@ public partial class Login
_configTitle = (await _serviceScope.ServiceProvider.GetService<IConfigService>().GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_TITLE))?.ConfigValue;
_configRemark = (await _serviceScope.ServiceProvider.GetService<IConfigService>().GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_REMARK))?.ConfigValue;
_showCaptcha = (await _serviceScope.ServiceProvider.GetService<IConfigService>().GetByConfigKeyAsync(ConfigConst.SYS_CONFIGBASEDEFAULT, ConfigConst.CONFIG_CAPTCHA_OPEN))?.ConfigValue?.ToBool(false) == true;
_welcome = "<EFBFBD><EFBFBD>ӭʹ<EFBFBD><EFBFBD>" + _configTitle + "!";
_welcome = "欢迎使用" + _configTitle + "!";
await base.OnParametersSetAsync();
}
@@ -102,11 +101,11 @@ public partial class Login
await _captcha.RefreshCode();
}
await PopupService.EnqueueSnackbarAsync(new("<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>" + ": " + ret.Msg.ToString(), AlertTypes.Error));
await PopupService.EnqueueSnackbarAsync(new("登录错误" + ": " + ret.Msg.ToString(), AlertTypes.Error));
}
else
{
await PopupService.EnqueueSnackbarAsync(new("<EFBFBD><EFBFBD>¼<EFBFBD>ɹ<EFBFBD>", AlertTypes.Success));
await PopupService.EnqueueSnackbarAsync(new("登录成功", AlertTypes.Success));
await Task.Delay(500);
var userId = await _serviceScope.ServiceProvider.GetService<SysUserService>().GetIdByAccountAsync(_loginModel.Account);
var data = await _serviceScope.ServiceProvider.GetService<UserCenterService>().GetLoginDefaultRazorAsync(userId);
@@ -124,7 +123,7 @@ public partial class Login
await _captcha.RefreshCode();
}
await PopupService.EnqueueSnackbarAsync(new("<EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD><EFBFBD><EFBFBD>", AlertTypes.Error));
await PopupService.EnqueueSnackbarAsync(new("登录错误", AlertTypes.Error));
}
}
private async Task<string> RefreshCode()

View File

@@ -1,12 +1,12 @@
#region copyright
#region copyright
//------------------------------------------------------------------------------
// <EFBFBD>˴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊȫ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <EFBFBD>˴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߱<EFBFBD><EFBFBD><EFBFBD>Diego<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD><EFBFBD>Ŀ<EFBFBD>ԴЭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD>
// GiteeԴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ⣺https://gitee.com/diego2098/ThingsGateway
// GithubԴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ⣺https://github.com/kimdiego2098/ThingsGateway
// ʹ<EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD>https://diego2098.gitee.io/thingsgateway-docs/
// QQȺ<EFBFBD><EFBFBD>605534569
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权(除特别声明外的代码)归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库:https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库:https://github.com/kimdiego2098/ThingsGateway
// 使用文档:https://diego2098.gitee.io/thingsgateway-docs/
// QQ群:605534569
//------------------------------------------------------------------------------
#endregion
@@ -44,7 +44,7 @@ public partial class MainLayout
[Inject]
private UserResoures _userResoures { get; set; }
/// <summary>
/// ҳ<EFBFBD><EFBFBD>ˢ<EFBFBD><EFBFBD>
/// 页面刷新
/// </summary>
/// <returns></returns>
public async Task StateHasChangedAsync()

View File

@@ -5,8 +5,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.1.4" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.117" />
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.1.5" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.123" />
<PackageReference Include="UAParser" Version="3.1.47" />
<PackageReference Include="Yitter.IdGenerator" Version="1.0.14" />
</ItemGroup>

View File

@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Furion.Pure" Version="4.9.1.4" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.1.4" />
<PackageReference Include="Furion.Pure" Version="4.9.1.5" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="4.9.1.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

View File

@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0;</TargetFrameworks>
<Version>4.0.0.1</Version>
<Version>4.0.0.4</Version>
<LangVersion>latest</LangVersion>
<Authors>Diego</Authors>
<Product>ThingsGateway</Product>

View File

@@ -1,6 +1,10 @@
<Project>
<!--如果编译net45报错无支持用一下方法添加net45包-->
<!--VS顶部菜单栏 -> 视图 -> 其他 -> 程序包控制台
Install-Package Microsoft.NETFramework.ReferenceAssemblies.net45
-->
<PropertyGroup>
<Version>4.0.0.1</Version>
<Version>4.0.0.4</Version>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<LangVersion>latest</LangVersion>
<TargetFrameworks>net45;netstandard2.0;net6.0;net8.0;</TargetFrameworks>

View File

@@ -1,7 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net45;netstandard2.0;net6.0;net8.0;</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />

View File

@@ -608,6 +608,7 @@ namespace ThingsGateway.Foundation.Sockets
this.OnAccepted(e);
}
}
catch (ObjectDisposedException) { }
catch (Exception ex)
{
this.Logger.Exception(ex);

View File

@@ -186,10 +186,6 @@ namespace ThingsGateway.Foundation.Sockets
}
}
}
catch (Exception ex)
{
return new();
}
finally
{
this.m_cancellationTokenSource = null;

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>4.0.0.1</Version>
<Version>4.0.0.4</Version>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<TargetFrameworks>net6.0;net8.0;</TargetFrameworks>

View File

@@ -109,8 +109,8 @@ public abstract class UpLoadBaseWithCacheT<DeviceT, VariableT> : UpLoadBase
CurrentDevice.DeviceVariableRunTimes.ForEach(a => { a.VariableValueChange += VariableValueChange; });
}
if (_uploadPropertyWithCache.CycleInterval <= 100) _uploadPropertyWithCache.CycleInterval = 100;
if (_uploadPropertyWithCache.UploadInterval <= 1000) _uploadPropertyWithCache.UploadInterval = 1000;
if (_uploadPropertyWithCache.CycleInterval <= 50) _uploadPropertyWithCache.CycleInterval = 50;
if (_uploadPropertyWithCache.UploadInterval <= 100) _uploadPropertyWithCache.UploadInterval = 100;
_exVariableTimerTick = new(_uploadPropertyWithCache.UploadInterval);
_exDeviceTimerTick = new(_uploadPropertyWithCache.UploadInterval);
}

View File

@@ -20,7 +20,7 @@ public class UploadPropertyWithCacheT : DriverPropertyBase
/// <summary>
/// 线程循环间隔
/// </summary>
[DeviceProperty("线程循环间隔", "最小10ms")]
[DeviceProperty("线程循环间隔", "最小50ms")]
public virtual int CycleInterval { get; set; } = 1000;
/// <summary>
/// 内存队列最大条数
@@ -47,7 +47,7 @@ public class UploadPropertyWithCacheT : DriverPropertyBase
/// <summary>
/// 上传间隔时间
/// </summary>
[DeviceProperty("上传间隔时间", "最小1000ms")]
[DeviceProperty("上传间隔时间", "最小100ms")]
public virtual int UploadInterval { get; set; } = 1000;
[DeviceProperty("是否选择全部变量", "")] public bool IsAllVariable { get; set; } = false;

View File

@@ -44,7 +44,7 @@ public class CollectDeviceService : DeviceService<CollectDevice>, ITransient
/// <inheritdoc/>
[OperDesc("复制设备与变量")]
[OperDesc("复制设备与变量", IsRecordPar = false)]
public virtual async Task CopyDevAndVarAsync(IEnumerable<CollectDevice> input)
{
var variableService = _serviceScope.ServiceProvider.GetService<VariableService>();

View File

@@ -10,6 +10,7 @@
//------------------------------------------------------------------------------
#endregion
using Furion.DependencyInjection;
using Furion.FriendlyException;
using Mapster;
@@ -30,6 +31,7 @@ using Yitter.IdGenerator;
namespace ThingsGateway.Gateway.Application;
[Injection(Proxy = typeof(OperDispatchProxy))]
public abstract class DeviceService<T> : DbRepository<T> where T : Device, new()
{
protected readonly IFileService _fileService;

View File

@@ -317,7 +317,7 @@ public class DriverPluginService : ISingleton
var data = _serviceScope.ServiceProvider.GetService<MemoryCache>().GetOrCreate($"{nameof(GetDriverVariableProperties)}", cacheKey, c =>
{
var data = driver.VariablePropertys?.GetType().GetProperties()?.SelectMany(it =>
new[] { new { memberInfo = it, attribute = GetCustomAttributeRecursive<DevicePropertyAttribute>(it) } })
new[] { new { memberInfo = it, attribute = GetCustomAttributeRecursive<VariablePropertyAttribute>(it) } })
?.Where(x => x.attribute != null).ToList()
?.SelectMany(it => new[]
{

View File

@@ -15,8 +15,7 @@
<PackageReference Include="CS-Script" Version="4.8.8" />
<!--CS-Script与Furion冲突直接安装覆盖版本-->
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.7.0" />
<PackageReference Include="MQTTnet" Version="4.3.1.873" />
<PackageReference Include="SqlSugar.TDengineCore" Version="3.2.0" />
<PackageReference Include="SqlSugar.TDengineCore" Version="3.4.0" />
</ItemGroup>
<ItemGroup>

View File

@@ -99,9 +99,9 @@ public class UploadDeviceWorker : DeviceWorker
{
if (!_stoppingToken.IsCancellationRequested)
{
_logger.LogInformation("正在获取北向组态信息");
_logger.LogInformation("正在获取北向设备组态信息");
var deviceRunTimes = (_serviceScope.ServiceProvider.GetService<UploadDeviceService>().GetDeviceRuntime());
_logger.LogInformation("获取北向组态信息完成");
_logger.LogInformation("获取北向设备组态信息完成");
foreach (var uploadDeviceRunTime in deviceRunTimes.Where(a => !deviceRunTimes.Any(b => a.Id == b.RedundantDeviceId && b.IsRedundant)))
{
if (!_stoppingToken.IsCancellationRequested)

View File

@@ -1,12 +1,12 @@
#region copyright
#region copyright
//------------------------------------------------------------------------------
// <EFBFBD>˴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊȫ<EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><EFBFBD>ֶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <EFBFBD>˴<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߱<EFBFBD><EFBFBD><EFBFBD>Diego<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD><EFBFBD>Ŀ<EFBFBD>ԴЭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD>
// GiteeԴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ⣺https://gitee.com/diego2098/ThingsGateway
// GithubԴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ⣺https://github.com/kimdiego2098/ThingsGateway
// ʹ<EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><EFBFBD><EFBFBD>https://diego2098.gitee.io/thingsgateway-docs/
// QQȺ<EFBFBD><EFBFBD>605534569
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权(除特别声明外的代码)归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库:https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库:https://github.com/kimdiego2098/ThingsGateway
// 使用文档:https://diego2098.gitee.io/thingsgateway-docs/
// QQ群:605534569
//------------------------------------------------------------------------------
#endregion
@@ -32,7 +32,7 @@ namespace ThingsGateway.Gateway.Blazor
try
{
await OnSaveAsync.InvokeAsync(Content);
//await InvokeAsync(async () => await PopupService.EnqueueSnackbarAsync("<EFBFBD>ɹ<EFBFBD>", AlertTypes.Success));
//await InvokeAsync(async () => await PopupService.EnqueueSnackbarAsync("成功", AlertTypes.Success));
await ClosePopupAsync();
}
catch (Exception ex)

View File

@@ -29,7 +29,7 @@
@layout MainLayout
@using ThingsGateway.Admin.Core;
@if (IsMobile)
@* @if (IsMobile)
{
@GetAppDataTable()
}
@@ -67,7 +67,9 @@ else
@GetAppDataTable()
</MCol>
</MRow>
}
} *@
@GetAppDataTable()
<ImportExcel @ref=_importExcel Import="SaveDeviceImportAsync" Preview="DeviceImportAsync" />

View File

@@ -19,7 +19,7 @@
@using Masa.Blazor.Presets;
@using System.IO;
@using Microsoft.AspNetCore.Authorization;
@using SqlSugar;
@using ThingsGateway.Admin.Blazor;
@using ThingsGateway.Admin.Core;
@@ -48,7 +48,7 @@
@if (_tabNumber == 1)
{
<MRow NoGutters>
<MCol Md=2 Cols="12">
@* <MCol Md=2 Cols="12">
<MCard Class="ma-2" Style=@($"height: calc(100vh - {BlazorResourceConst.DefaultHeight + 80}px );")>
<MCardTitle>
@@ -73,12 +73,14 @@
</LabelContent>
</MTreeview>
</MCard>
</MCol>
<MCol Md=3 Cols="12">
</MCol> *@
<MCol Md=5 Cols="12">
<MCard Height=@($"calc(100vh - {BlazorResourceConst.DefaultHeight + 80}px; )") Style="overflow-y:auto;" Flat Class="ml-2 my-4">
<MTextField Dense Style="max-width:200px;" HideDetails=@("auto") Class="mx-2 my-1" @bind-Value="_collectDeviceGroupSearchName"
Outlined Label=@typeof(CollectDevice).GetDescription(nameof(CollectDevice.DeviceGroup)) />
<MVirtualScroll Context="item" Height=@($"calc(100vh - {BlazorResourceConst.DefaultHeight+100}px)") OverscanCount=2 ItemSize="60" Items="_collectDriverBases">
<MVirtualScroll Context="item" Height=@($"calc(100vh - {BlazorResourceConst.DefaultHeight+140}px)") OverscanCount=2 ItemSize="60" Items="_collectDriverBases.WhereIF(!_collectDeviceGroupSearchName.IsNullOrEmpty(),a=>a.CurrentDevice.DeviceGroup==_collectDeviceGroupSearchName).ToList()">
<ItemContent>
@if (item.CurrentDevice != null)
@@ -250,7 +252,7 @@
@if (_tabNumber == 2)
{
<MRow>
<MCol Md=2 Cols="12">
@* <MCol Md=2 Cols="12">
<MCard Class="ma-2" Style=@($"height: calc(100vh - {BlazorResourceConst.DefaultHeight + 80}px); )")>
<MCardTitle>
<MTextField Dense Style="max-width:200px;" HideDetails=@("auto") Class="mx-2 my-1" @bind-Value="_uploadDeviceGroupSearchName"
@@ -274,11 +276,13 @@
</LabelContent>
</MTreeview>
</MCard>
</MCol>
<MCol Md=3 Cols="12">
</MCol> *@
<MCol Md=5 Cols="12">
<MCard Height=@($"calc(100vh - {BlazorResourceConst.DefaultHeight+80}px)") Style="overflow-y:auto;" Flat Class="ml-2 my-4">
<MTextField Dense Style="max-width:200px;" HideDetails=@("auto") Class="mx-2 my-1" @bind-Value="_uploadDeviceGroupSearchName"
Outlined Label=@typeof(CollectDevice).GetDescription(nameof(CollectDevice.DeviceGroup)) />
<MVirtualScroll Context="item" Height=@($"calc(100vh - {BlazorResourceConst.DefaultHeight+100}px)") OverscanCount=2 ItemSize="60" Items="_uploadDriverBases">
<MVirtualScroll Context="item" Height=@($"calc(100vh - {BlazorResourceConst.DefaultHeight+140}px)") OverscanCount=2 ItemSize="60" Items="_uploadDriverBases.WhereIF(!_uploadDeviceGroupSearchName.IsNullOrEmpty(),a=>a.CurrentDevice.DeviceGroup==_uploadDeviceGroupSearchName).ToList()">
<ItemContent>
@if (item.CurrentDevice != null)

View File

@@ -30,7 +30,7 @@
@inject UserResoures UserResoures
@layout MainLayout
@if (IsMobile)
@* @if (IsMobile)
{
@GetAppDataTable()
@@ -69,7 +69,8 @@ else
</MCol>
</MRow>
}
} *@
@GetAppDataTable()
<ImportExcel @ref=_importExcel Import="SaveDeviceImportAsync" Preview="DeviceImportAsync" />

View File

@@ -30,7 +30,7 @@
@inherits BaseComponentBase
@inject UserResoures UserResoures
@layout MainLayout
@if (IsMobile)
@* @if (IsMobile)
{
@GetAppDataTable()
@@ -69,7 +69,11 @@ else
@GetAppDataTable()
</MCol>
</MRow>
}
} *@
@GetAppDataTable()
@code {
RenderFragment GetAppDataTable()
{

View File

@@ -29,7 +29,7 @@
@layout MainLayout
@using ThingsGateway.Admin.Core;
@if (IsMobile)
@* @if (IsMobile)
{
@GetAppDataTable()
}
@@ -67,8 +67,9 @@ else
@GetAppDataTable()
</MCol>
</MRow>
}
} *@
@GetAppDataTable()
<ImportExcel @ref=_importExcel Import="SaveDeviceImportAsync" Preview="DeviceImportAsync" />

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>4.0.0.1</Version>
<Version>4.0.0.4</Version>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<TargetFrameworks>net6.0;net8.0;</TargetFrameworks>
@@ -14,10 +14,6 @@
</PropertyGroup>
<!--<PropertyGroup>
<EnableDynamicLoading>true</EnableDynamicLoading>
</PropertyGroup>-->
<ItemGroup>
<ProjectReference Include="..\..\gateway\ThingsGateway.Gateway.Application\ThingsGateway.Gateway.Application.csproj" >

View File

@@ -16,8 +16,6 @@ using LiteDB;
using Microsoft.Extensions.Logging;
using MQTTnet.Diagnostics;
using System.Runtime.InteropServices;
using ThingsGateway.Foundation.Extension.ConcurrentQueue;

View File

@@ -85,7 +85,7 @@ public class ModbusSerialServer : UpLoadBase
var tags = CurrentDevice.DeviceVariableRunTimes
.Where(b => !string.IsNullOrEmpty(
b.GetPropertyValue(DeviceId, nameof(_variablePropertys.ServiceAddress)).Value))
b.GetPropertyValue(DeviceId, nameof(_variablePropertys.ServiceAddress))?.Value))
.ToList();
tags.ForEach(a =>

View File

@@ -64,6 +64,7 @@ public class ModbusTcpServer : UpLoadBase
iPHost = new IPHost($"{_driverPropertys.IP}:{_driverPropertys.Port}");
}
FoundataionConfig.SetListenIPHosts(new IPHost[] { iPHost });
FoundataionConfig.SetMaxCount(30000);
var service = new TcpService();
service.Setup(FoundataionConfig);
//载入配置
@@ -78,7 +79,7 @@ public class ModbusTcpServer : UpLoadBase
var tags = CurrentDevice.DeviceVariableRunTimes
.Where(b => !string.IsNullOrEmpty(
b.GetPropertyValue(DeviceId, nameof(_variablePropertys.ServiceAddress)).Value))
b.GetPropertyValue(DeviceId, nameof(_variablePropertys.ServiceAddress))?.Value))
.ToList();
tags.ForEach(a =>

View File

@@ -112,7 +112,7 @@ public partial class IotSharpClient : UpLoadBaseWithCacheT<DeviceData, VariableD
var tag = CurrentDevice.DeviceVariableRunTimes.FirstOrDefault(a => a.Name == item.Key);
if (tag != null)
{
var rpcEnable = tag.GetPropertyValue(DeviceId, nameof(_variablePropertys.VariableRpcEnable)).Value.ToBool(false) && _driverPropertys.DeviceRpcEnable;
var rpcEnable = tag.GetPropertyValue(DeviceId, nameof(_variablePropertys.VariableRpcEnable))?.Value?.ToBool() == true && _driverPropertys.DeviceRpcEnable;
if (!rpcEnable)
{
results.Add(item.Key, new OperResult("权限不足,变量不支持写入"));

View File

@@ -69,14 +69,20 @@ public partial class MqttClient : UpLoadBaseWithCacheT<DeviceData, VariableData>
{
base.Init(client);
var mqttFactory = new MqttFactory();
_mqttClientOptions = mqttFactory.CreateClientOptionsBuilder()
var mqttClientOptionsBuilder = mqttFactory.CreateClientOptionsBuilder()
.WithClientId(_driverPropertys.ConnectId)
.WithCredentials(_driverPropertys.UserName, _driverPropertys.Password)//账密
.WithTcpServer(_driverPropertys.IP, _driverPropertys.Port)//服务器
.WithCleanSession(true)
.WithKeepAlivePeriod(TimeSpan.FromSeconds(120.0))
.WithoutThrowOnNonSuccessfulConnectResponse()
.WithoutThrowOnNonSuccessfulConnectResponse();
if (_driverPropertys.IsWebSocket)
_mqttClientOptions = mqttClientOptionsBuilder.WithWebSocketServer(a => a.WithUri(_driverPropertys.WebSocktUrl))
.Build();
else
_mqttClientOptions = mqttClientOptionsBuilder.WithTcpServer(_driverPropertys.IP, _driverPropertys.Port)//服务器
.Build();
_mqttSubscribeOptions = mqttFactory.CreateSubscribeOptionsBuilder()
.WithTopicFilter(
f =>

View File

@@ -134,7 +134,7 @@ public partial class MqttClient : UpLoadBaseWithCacheT<DeviceData, VariableData>
var tag = CurrentDevice.DeviceVariableRunTimes.FirstOrDefault(a => a.Name == rpcData.Key);
if (tag != null)
{
var rpcEnable = tag.GetPropertyValue(DeviceId, nameof(_variablePropertys.VariableRpcEnable)).Value.ToBool();
var rpcEnable = tag.GetPropertyValue(DeviceId, nameof(_variablePropertys.VariableRpcEnable))?.Value?.ToBool();
if (rpcEnable == true)
{

View File

@@ -29,6 +29,16 @@ public class MqttClientProperty : UploadPropertyWithCacheT
[DeviceProperty("端口", "")]
public override int Port { get; set; } = 1883;
/// <summary>
/// 是否websocket连接
/// </summary>
[DeviceProperty("是否WebSocket连接", "true=>websocketflase=>tcp")]
public bool IsWebSocket { get; set; } = false;
/// <summary>
/// WebSocktUrl
/// </summary>
[DeviceProperty("WebSocktUrl", "")]
public string WebSocktUrl { get; set; } = "ws://127.0.0.1:8083/mqtt";
/// <summary>
/// 账号
/// </summary>
[DeviceProperty("账号", "")]

View File

@@ -14,15 +14,18 @@ using Furion;
using Mapster;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using MQTTnet;
using MQTTnet.AspNetCore;
using MQTTnet.Internal;
using MQTTnet.Protocol;
using MQTTnet.Server;
using System.Collections.Concurrent;
using System.Net;
using System.Text;
using ThingsGateway.Admin.Application;
@@ -93,6 +96,7 @@ public class MqttServer : UpLoadBase
_mqttServer.InterceptingSubscriptionAsync -= MqttServer_InterceptingSubscriptionAsync; ;
_mqttServer?.SafeDispose();
}
_webHost?.Dispose();
_globalDeviceData?.AllVariables?.ForEach(a => a.VariableValueChange -= VariableValueChange);
_globalDeviceData?.CollectDevices?.ForEach(a =>
{
@@ -102,16 +106,32 @@ public class MqttServer : UpLoadBase
_collectVariableRunTimes.Clear();
base.Dispose(disposing);
}
private IWebHost _webHost { get; set; }
protected override void Init(ISenderClient client = null)
{
var mqttFactory = new MqttFactory();
var mqttServerOptions = mqttFactory.CreateServerOptionsBuilder()
.WithDefaultEndpointBoundIPAddress(string.IsNullOrEmpty(_driverPropertys.IP) ? null : IPAddress.Parse(_driverPropertys.IP))
.WithDefaultEndpointPort(_driverPropertys.Port)
.WithDefaultEndpoint()
.Build();
_mqttServer = mqttFactory.CreateMqttServer(mqttServerOptions);
//var mqttFactory = new MqttFactory();
//var mqttServerOptions = mqttFactory.CreateServerOptionsBuilder()
// .WithDefaultEndpointBoundIPAddress(string.IsNullOrEmpty(_driverPropertys.IP) ? null : IPAddress.Parse(_driverPropertys.IP))
// .WithDefaultEndpointPort(_driverPropertys.Port)
// .WithDefaultEndpoint()
// .Build();
//_mqttServer = mqttFactory.CreateMqttServer(mqttServerOptions);
var configuration = new ConfigurationBuilder()
.SetBasePath(Directory)
.Build();
var webBuilder = new WebHostBuilder()
.UseKestrel(
o =>
{
o.ListenAnyIP(_driverPropertys.Port, l => l.UseMqtt());
o.ListenAnyIP(_driverPropertys.WebSocketPort);
});
webBuilder.UseStartup<MqttServerStartup>();
_webHost = webBuilder.UseConfiguration(configuration)
.Build();
_mqttServer = _webHost.Services.GetService<MqttHostedServer>();
CollectDevices.Where(a => CurrentDevice.DeviceVariableRunTimes.Select(b => b.DeviceId).Contains(a.Id)).ForEach(a =>
{
@@ -121,11 +141,11 @@ public class MqttServer : UpLoadBase
{
a.VariableValueChange += VariableValueChange;
});
}
protected override async Task ProtectedBeforStartAsync(CancellationToken cancellationToken)
{
_ = _webHost.StartAsync(cancellationToken);
if (_mqttServer != null)
{
_mqttServer.ValidatingConnectionAsync += MqttServer_ValidatingConnectionAsync;
@@ -288,7 +308,7 @@ public class MqttServer : UpLoadBase
var tag = CurrentDevice.DeviceVariableRunTimes.FirstOrDefault(a => a.Name == rpcData.Key);
if (tag != null)
{
var rpcEnable = tag.GetPropertyValue(DeviceId, nameof(_variablePropertys.VariableRpcEnable)).Value.ToBool(false);
var rpcEnable = tag.GetPropertyValue(DeviceId, nameof(_variablePropertys.VariableRpcEnable))?.Value?.ToBool() == true;
if (!rpcEnable)
{
mqttRpcResult.Success = false;

View File

@@ -17,17 +17,18 @@ namespace ThingsGateway.Plugin.Mqtt;
public class MqttServerProperty : DriverPropertyBase
{
[DeviceProperty("是否选择全部变量", "")] public bool IsAllVariable { get; set; } = false;
/// <summary>
/// IP
/// </summary>
[DeviceProperty("IP", "留空则全部监听")]
public override string IP { get; set; } = "";
/// <summary>
/// 端口
/// </summary>
[DeviceProperty("端口", "")]
public override int Port { get; set; } = 1883;
/// <summary>
/// WebSocket端口
/// </summary>
[DeviceProperty("WebSocket端口", "")]
public int WebSocketPort { get; set; } = 8083;
/// <summary>
/// 允许连接的ID(前缀)
/// </summary>
[DeviceProperty("允许连接的ID(前缀)", "")]

View File

@@ -0,0 +1,63 @@
#region copyright
//------------------------------------------------------------------------------
// 此代码版权声明为全文件覆盖,如有原作者特别声明,会在下方手动补充
// 此代码版权除特别声明外的代码归作者本人Diego所有
// 源代码使用协议遵循本仓库的开源协议及附加协议
// Gitee源代码仓库https://gitee.com/diego2098/ThingsGateway
// Github源代码仓库https://github.com/kimdiego2098/ThingsGateway
// 使用文档https://diego2098.gitee.io/thingsgateway-docs/
// QQ群605534569
//------------------------------------------------------------------------------
#endregion
using Mapster;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using MQTTnet.AspNetCore;
using MQTTnet.Diagnostics;
namespace MQTTnet.Server;
/// <summary>
/// MqttServerStartup
/// </summary>
public class MqttServerStartup
{
/// <inheritdoc/>
public void ConfigureServices(IServiceCollection services)
{
services.AddSingleton(s =>
{
var serverOptionsBuilder = new MqttServerOptionsBuilder();
serverOptionsBuilder.WithDefaultEndpoint();
return serverOptionsBuilder.Build();
});
var logger = new MqttNetEventLogger();
services.AddSingleton<IMqttNetLogger>(logger);
services.AddSingleton<MqttHostedServer>();
//services.AddSingleton<IHostedService>(s => s.GetService<MqttHostedServer>());
////不再注册HostService,MqttServer的生命周期由插件完成
services.AddSingleton<MqttServer>(s => s.GetService<MqttHostedServer>());
services.AddMqttConnectionHandler();
services.AddConnections();
}
/// <inheritdoc/>
public void Configure(IApplicationBuilder app)
{
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapConnectionHandler<MqttConnectionHandler>(
"/mqtt",
httpConnectionDispatcherOptions => httpConnectionDispatcherOptions.WebSockets.SubProtocolSelector =
protocolList => protocolList.FirstOrDefault() ?? string.Empty);
});
}
}

View File

@@ -3,10 +3,15 @@
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command=" set dir=&quot;$(SolutionDir)web\ThingsGateway.Web.Entry\bin\$(Configuration)\$(TargetFramework)\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist %25dir%25 md %25dir%25 &#xD;&#xA;copy &quot;$(TargetDir)*Mqtt*.dll&quot; %25dir%25&#xD;&#xA;&#xD;&#xA;&#xD;&#xA;" />
<Exec Command=" set dir=&quot;$(SolutionDir)web\ThingsGateway.Web.Entry\bin\$(Configuration)\$(TargetFramework)\Plugins\$(AssemblyName)&quot;&#xD;&#xA; if not exist %25dir%25 md %25dir%25 &#xD;&#xA;copy &quot;$(TargetDir)*Mqtt*.dll&quot; %25dir%25&#xD;&#xA;&#xD;&#xA;copy &quot;$(TargetDir)*MQTTnet.AspNetCore*.dll&quot; %25dir%25&#xD;&#xA;" />
</Target>
<ItemGroup>
<PackageReference Include="MQTTnet.AspNetCore" Version="4.3.1.873" />
</ItemGroup>
<PropertyGroup>
<EnableDynamicLoading>true</EnableDynamicLoading>
</PropertyGroup>
</Project>

View File

@@ -16,8 +16,6 @@ using Mapster;
using Microsoft.Extensions.Logging;
using MQTTnet.Diagnostics;
using SqlSugar;
using ThingsGateway.Foundation.Extension.ConcurrentQueue;

View File

@@ -14,8 +14,6 @@ using LiteDB;
using Microsoft.Extensions.Logging;
using MQTTnet.Diagnostics;
using RabbitMQ.Client;
using ThingsGateway.Foundation.Extension.ConcurrentQueue;

View File

@@ -16,8 +16,6 @@ using Mapster;
using Microsoft.Extensions.Logging;
using MQTTnet.Diagnostics;
using ThingsGateway.Foundation.Extension.ConcurrentQueue;
using ThingsGateway.Foundation.Sockets;

View File

@@ -16,8 +16,6 @@ using Mapster;
using Microsoft.Extensions.Logging;
using MQTTnet.Diagnostics;
using ThingsGateway.Foundation.Extension.ConcurrentQueue;
using ThingsGateway.Foundation.Sockets;

View File

@@ -16,8 +16,6 @@ using Mapster;
using Microsoft.Extensions.Logging;
using MQTTnet.Diagnostics;
using SqlSugar;
using ThingsGateway.Foundation.Extension.ConcurrentQueue;

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>4.0.0.1</Version>
<Version>4.0.0.4</Version>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<TargetFrameworks>net6.0;net8.0;</TargetFrameworks>
@@ -13,6 +13,4 @@
<SatelliteResourceLanguages>zh-Hans</SatelliteResourceLanguages>
</PropertyGroup>
</Project>

View File

@@ -54,20 +54,6 @@ public class Program
builder.Host.UseWindowsService();
builder.Host.UseSystemd();
#if AF2021
builder.WebHost.UseKestrel(
o =>
{
var config = Furion.App.GetConfig<ThingsGateway.Gateway.LK.MqttConfig>("MqttConfig", true);
if (config.Enable)
{
o.ListenAnyIP(config.Port, a => MQTTnet.AspNetCore.ConnectionBuilderExtensions.UseMqtt(a));
o.ListenAnyIP(config.WebSocketPort);
}
});
#endif
//Furion便利方法
builder.Inject();
var app = builder.Build();

View File

@@ -7,12 +7,6 @@
<!--<PlatformTarget>x86</PlatformTarget>-->
</PropertyGroup>
<ItemGroup>
<_WebToolingArtifacts Remove="Properties\PublishProfiles\linux64_net6.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\linux64_net8.pubxml" />
</ItemGroup>
<ItemGroup>
<Content Update="pm2-linux.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -50,17 +44,5 @@
<!--pro内容-->
<PropertyGroup Condition="'$(SolutionName)'=='ThingsGateway - Pro - AF2021'">
<DefineConstants>AF2021</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(SolutionName)'=='ThingsGateway - Pro - AF2021'">
<ProjectReference Include="..\..\PluginProAF2021\ThingsGateway.Gateway.LK\ThingsGateway.Gateway.LK.csproj" />
<PackageReference Include="MQTTnet.AspNetCore" Version="4.3.1.873" />
</ItemGroup>
</Project>