😎升级依赖调整文件编码

This commit is contained in:
zuohuaijun 2025-09-18 00:20:32 +08:00
parent a72916e179
commit 78d9af6e5a
4 changed files with 109 additions and 109 deletions

View File

@ -22,7 +22,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AlibabaCloud.SDK.Dysmsapi20170525" Version="4.0.0" /> <PackageReference Include="AlibabaCloud.SDK.Dysmsapi20170525" Version="4.0.0" />
<PackageReference Include="AlipaySDKNet.Standard" Version="4.9.799" /> <PackageReference Include="AlipaySDKNet.Standard" Version="4.9.808" />
<PackageReference Include="AngleSharp" Version="1.3.0" /> <PackageReference Include="AngleSharp" Version="1.3.0" />
<PackageReference Include="AspectCore.Extensions.Reflection" Version="2.4.0" /> <PackageReference Include="AspectCore.Extensions.Reflection" Version="2.4.0" />
<PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" /> <PackageReference Include="AspNetCoreRateLimit" Version="5.0.0" />
@ -40,7 +40,7 @@
<PackageReference Include="Magicodes.IE.Pdf" Version="2.7.6" /> <PackageReference Include="Magicodes.IE.Pdf" Version="2.7.6" />
<PackageReference Include="Magicodes.IE.Word" Version="2.7.6" /> <PackageReference Include="Magicodes.IE.Word" Version="2.7.6" />
<PackageReference Include="MailKit" Version="4.13.0" /> <PackageReference Include="MailKit" Version="4.13.0" />
<PackageReference Include="MiniExcel" Version="1.41.3" /> <PackageReference Include="MiniExcel" Version="1.41.4" />
<PackageReference Include="MiniWord" Version="0.9.2" /> <PackageReference Include="MiniWord" Version="0.9.2" />
<PackageReference Include="MQTTnet.Server" Version="5.0.1.1416" /> <PackageReference Include="MQTTnet.Server" Version="5.0.1.1416" />
<PackageReference Include="MySqlBackup.NET.MySqlConnector" Version="2.6.5" /> <PackageReference Include="MySqlBackup.NET.MySqlConnector" Version="2.6.5" />
@ -52,7 +52,7 @@
<PackageReference Include="SixLabors.ImageSharp.Web" Version="3.2.0" /> <PackageReference Include="SixLabors.ImageSharp.Web" Version="3.2.0" />
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.11.0" /> <PackageReference Include="SKIT.FlurlHttpClient.Wechat.Api" Version="3.11.0" />
<PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.13.0" /> <PackageReference Include="SKIT.FlurlHttpClient.Wechat.TenpayV3" Version="3.13.0" />
<PackageReference Include="SqlSugar.MongoDbCore" Version="5.1.4.262" /> <PackageReference Include="SqlSugar.MongoDbCore" Version="5.1.4.264" />
<PackageReference Include="SqlSugarCore" Version="5.1.4.202" /> <PackageReference Include="SqlSugarCore" Version="5.1.4.202" />
<PackageReference Include="SSH.NET" Version="2025.0.0" /> <PackageReference Include="SSH.NET" Version="2025.0.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.7" /> <PackageReference Include="System.Linq.Dynamic.Core" Version="1.6.7" />

View File

@ -1,13 +1,13 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。 // Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
// //
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。 // 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
// //
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任! // 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
namespace Admin.NET.Core; namespace Admin.NET.Core;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using MQTTnet; using MQTTnet;
using MQTTnet.Protocol; using MQTTnet.Protocol;
using MQTTnet.Server; using MQTTnet.Server;
using System; using System;
@ -19,34 +19,34 @@ using System.Threading.Tasks;
/// MQTT 服务 /// MQTT 服务
/// </summary> /// </summary>
public class MqttHostedService(IOptions<MqttOptions> mqttOptions) : IHostedService, ISingleton public class MqttHostedService(IOptions<MqttOptions> mqttOptions) : IHostedService, ISingleton
{ {
private readonly MqttOptions _mqttOptions = mqttOptions.Value; private readonly MqttOptions _mqttOptions = mqttOptions.Value;
public static MqttServer MqttServer { get; set; } public static MqttServer MqttServer { get; set; }
public static readonly List<MqttEventInterceptor> MqttEventInterceptors = []; // MQTT 事件拦截器集合 public static readonly List<MqttEventInterceptor> MqttEventInterceptors = []; // MQTT 事件拦截器集合
/// <summary> /// <summary>
/// 注册 MQTT 事件拦截器 /// 注册 MQTT 事件拦截器
/// </summary> /// </summary>
/// <param name="mqttEventInterceptor"></param> /// <param name="mqttEventInterceptor"></param>
/// <param name="order"></param> /// <param name="order"></param>
public static void AddMqttEventInterceptor(MqttEventInterceptor mqttEventInterceptor, int order = 0) public static void AddMqttEventInterceptor(MqttEventInterceptor mqttEventInterceptor, int order = 0)
{ {
mqttEventInterceptor.Order = order; mqttEventInterceptor.Order = order;
MqttEventInterceptors.Add(mqttEventInterceptor); MqttEventInterceptors.Add(mqttEventInterceptor);
MqttEventInterceptors.Sort((a, b) => b.Order - a.Order); MqttEventInterceptors.Sort((a, b) => b.Order - a.Order);
} }
public async Task StartAsync(CancellationToken cancellationToken) public async Task StartAsync(CancellationToken cancellationToken)
{ {
if (!_mqttOptions.Enabled) return; if (!_mqttOptions.Enabled) return;
// 注册 MQTT 自定义客户端验证事件拦截器 // 注册 MQTT 自定义客户端验证事件拦截器
AddMqttEventInterceptor(new DefaultMqttEventInterceptor()); AddMqttEventInterceptor(new DefaultMqttEventInterceptor());
var options = new MqttServerOptionsBuilder() var options = new MqttServerOptionsBuilder()
.WithDefaultEndpoint() // 默认地址127.0.0.1 .WithDefaultEndpoint() // 默认地址127.0.0.1
.WithDefaultEndpointPort(_mqttOptions.Port) // 端口号 .WithDefaultEndpointPort(_mqttOptions.Port) // 端口号
//.WithDefaultEndpointBoundIPAddress(_mqttOptions.IPAddress) // IP地址 //.WithDefaultEndpointBoundIPAddress(_mqttOptions.IPAddress) // IP地址
.WithConnectionBacklog(_mqttOptions.ConnectionBacklog) // 最大连接数 .WithConnectionBacklog(_mqttOptions.ConnectionBacklog) // 最大连接数
.WithPersistentSessions() .WithPersistentSessions()
.Build(); .Build();
@ -85,10 +85,10 @@ public class MqttHostedService(IOptions<MqttOptions> mqttOptions) : IHostedServi
/// <returns></returns> /// <returns></returns>
private async Task MqttServer_StoppedAsync(EventArgs arg) private async Task MqttServer_StoppedAsync(EventArgs arg)
{ {
Console.WriteLine($"【MQTT】服务已关闭...... {DateTime.Now}"); Console.WriteLine($"【MQTT】服务已关闭...... {DateTime.Now}");
foreach (var eh in MqttEventInterceptors) foreach (var eh in MqttEventInterceptors)
{ {
await eh.StoppedAsync(arg); await eh.StoppedAsync(arg);
} }
} }
@ -99,11 +99,11 @@ public class MqttHostedService(IOptions<MqttOptions> mqttOptions) : IHostedServi
/// <returns></returns> /// <returns></returns>
private async Task MqttServer_ValidatingConnectionAsync(ValidatingConnectionEventArgs arg) private async Task MqttServer_ValidatingConnectionAsync(ValidatingConnectionEventArgs arg)
{ {
foreach (var eh in MqttEventInterceptors) foreach (var eh in MqttEventInterceptors)
{ {
await eh.ValidatingConnectionAsync(arg); await eh.ValidatingConnectionAsync(arg);
if (arg.ReasonCode != MqttConnectReasonCode.Success) if (arg.ReasonCode != MqttConnectReasonCode.Success)
break; break;
} }
} }
@ -113,12 +113,12 @@ public class MqttHostedService(IOptions<MqttOptions> mqttOptions) : IHostedServi
/// <param name="arg"></param> /// <param name="arg"></param>
/// <returns></returns> /// <returns></returns>
private async Task MqttServer_ClientConnectedAsync(ClientConnectedEventArgs arg) private async Task MqttServer_ClientConnectedAsync(ClientConnectedEventArgs arg)
{ {
foreach (var eh in MqttEventInterceptors) foreach (var eh in MqttEventInterceptors)
{ {
await eh.ClientConnectedAsync(arg); await eh.ClientConnectedAsync(arg);
} }
Logging($"客户端连接客户端ID=【{arg.ClientId}】已连接:用户名=【{arg.UserName}】地址=【{arg.RemoteEndPoint}】 {DateTime.Now}"); Logging($"客户端连接客户端ID=【{arg.ClientId}】已连接:用户名=【{arg.UserName}】地址=【{arg.RemoteEndPoint}】 {DateTime.Now}");
} }
@ -130,11 +130,11 @@ public class MqttHostedService(IOptions<MqttOptions> mqttOptions) : IHostedServi
/// <exception cref="NotImplementedException"></exception> /// <exception cref="NotImplementedException"></exception>
private async Task MqttServer_ClientDisconnectedAsync(ClientDisconnectedEventArgs arg) private async Task MqttServer_ClientDisconnectedAsync(ClientDisconnectedEventArgs arg)
{ {
foreach (var eh in MqttEventInterceptors) foreach (var eh in MqttEventInterceptors)
{ {
await eh.ClientDisconnectedAsync(arg); await eh.ClientDisconnectedAsync(arg);
} }
Logging($"客户端断开客户端ID=【{arg.ClientId}】已断开:用户名=【{arg.UserName}】地址=【{arg.RemoteEndPoint}】 {DateTime.Now}"); Logging($"客户端断开客户端ID=【{arg.ClientId}】已断开:用户名=【{arg.UserName}】地址=【{arg.RemoteEndPoint}】 {DateTime.Now}");
} }
@ -145,11 +145,11 @@ public class MqttHostedService(IOptions<MqttOptions> mqttOptions) : IHostedServi
/// <returns></returns> /// <returns></returns>
private async Task MqttServer_ClientSubscribedTopicAsync(ClientSubscribedTopicEventArgs arg) private async Task MqttServer_ClientSubscribedTopicAsync(ClientSubscribedTopicEventArgs arg)
{ {
foreach (var eh in MqttEventInterceptors) foreach (var eh in MqttEventInterceptors)
{ {
await eh.ClientSubscribedTopicAsync(arg); await eh.ClientSubscribedTopicAsync(arg);
} }
Logging($"订阅主题客户端ID=【{arg.ClientId}】订阅主题=【{arg.TopicFilter}】 {DateTime.Now}"); Logging($"订阅主题客户端ID=【{arg.ClientId}】订阅主题=【{arg.TopicFilter}】 {DateTime.Now}");
} }
@ -160,11 +160,11 @@ public class MqttHostedService(IOptions<MqttOptions> mqttOptions) : IHostedServi
/// <returns></returns> /// <returns></returns>
private async Task MqttServer_ClientUnsubscribedTopicAsync(ClientUnsubscribedTopicEventArgs arg) private async Task MqttServer_ClientUnsubscribedTopicAsync(ClientUnsubscribedTopicEventArgs arg)
{ {
foreach (var eh in MqttEventInterceptors) foreach (var eh in MqttEventInterceptors)
{ {
await eh.ClientUnsubscribedTopicAsync(arg); await eh.ClientUnsubscribedTopicAsync(arg);
} }
Logging($"取消订阅客户端ID=【{arg.ClientId}】取消订阅主题=【{arg.TopicFilter}】 {DateTime.Now}"); Logging($"取消订阅客户端ID=【{arg.ClientId}】取消订阅主题=【{arg.TopicFilter}】 {DateTime.Now}");
} }
@ -178,11 +178,11 @@ public class MqttHostedService(IOptions<MqttOptions> mqttOptions) : IHostedServi
if (string.Equals(arg.ClientId, _mqttOptions.MqttServerId)) if (string.Equals(arg.ClientId, _mqttOptions.MqttServerId))
return; return;
foreach (var eh in MqttEventInterceptors) foreach (var eh in MqttEventInterceptors)
{ {
await eh.InterceptingPublishAsync(arg); await eh.InterceptingPublishAsync(arg);
} }
Logging($"拦截消息客户端ID=【{arg.ClientId}】 Topic主题=【{arg.ApplicationMessage.Topic}】 消息=【{Encoding.UTF8.GetString(arg.ApplicationMessage.Payload)}】 qos等级=【{arg.ApplicationMessage.QualityOfServiceLevel}】 {DateTime.Now}"); Logging($"拦截消息客户端ID=【{arg.ClientId}】 Topic主题=【{arg.ApplicationMessage.Topic}】 消息=【{Encoding.UTF8.GetString(arg.ApplicationMessage.Payload)}】 qos等级=【{arg.ApplicationMessage.QualityOfServiceLevel}】 {DateTime.Now}");
} }
@ -192,49 +192,49 @@ public class MqttHostedService(IOptions<MqttOptions> mqttOptions) : IHostedServi
/// <param name="arg"></param> /// <param name="arg"></param>
/// <returns></returns> /// <returns></returns>
private async Task MqttServer_ApplicationMessageNotConsumedAsync(ApplicationMessageNotConsumedEventArgs arg) private async Task MqttServer_ApplicationMessageNotConsumedAsync(ApplicationMessageNotConsumedEventArgs arg)
{ {
foreach (var eh in MqttEventInterceptors) foreach (var eh in MqttEventInterceptors)
{ {
await eh.ApplicationMessageNotConsumedAsync(arg); await eh.ApplicationMessageNotConsumedAsync(arg);
} }
Logging($"接收消息发送端ID=【{arg.SenderId}】 Topic主题=【{arg.ApplicationMessage.Topic}】 消息=【{Encoding.UTF8.GetString(arg.ApplicationMessage.Payload)}】 qos等级=【{arg.ApplicationMessage.QualityOfServiceLevel}】 {DateTime.Now}"); Logging($"接收消息发送端ID=【{arg.SenderId}】 Topic主题=【{arg.ApplicationMessage.Topic}】 消息=【{Encoding.UTF8.GetString(arg.ApplicationMessage.Payload)}】 qos等级=【{arg.ApplicationMessage.QualityOfServiceLevel}】 {DateTime.Now}");
} }
/// <summary> /// <summary>
/// 发布主题消息 /// 发布主题消息
/// </summary> /// </summary>
/// <param name="topic"></param> /// <param name="topic"></param>
/// <param name="message"></param> /// <param name="message"></param>
public async Task PublicMessageAsync(string topic, string message) public async Task PublicMessageAsync(string topic, string message)
{ {
var applicationMessage = new MqttApplicationMessageBuilder() var applicationMessage = new MqttApplicationMessageBuilder()
.WithTopic(topic) .WithTopic(topic)
.WithPayload(message) .WithPayload(message)
.Build(); .Build();
await MqttServer.InjectApplicationMessage(new InjectedMqttApplicationMessage(applicationMessage) await MqttServer.InjectApplicationMessage(new InjectedMqttApplicationMessage(applicationMessage)
{ {
SenderClientId = _mqttOptions.MqttServerId, SenderClientId = _mqttOptions.MqttServerId,
SenderUserName = _mqttOptions.MqttServerId, SenderUserName = _mqttOptions.MqttServerId,
}); });
Logging($"服务器发布主题:{topic}, 内容:{message}"); Logging($"服务器发布主题:{topic}, 内容:{message}");
} }
public Task StopAsync(CancellationToken cancellationToken) public Task StopAsync(CancellationToken cancellationToken)
{ {
return Task.CompletedTask; return Task.CompletedTask;
} }
/// <summary> /// <summary>
/// 输出日志 /// 输出日志
/// </summary> /// </summary>
/// <param name="msg"></param> /// <param name="msg"></param>
protected void Logging(string msg) protected void Logging(string msg)
{ {
if (!_mqttOptions.Logging) return; if (!_mqttOptions.Logging) return;
Console.WriteLine(msg); Console.WriteLine(msg);
Log.Information(msg); Log.Information(msg);
} }
} }

View File

@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 18
VisualStudioVersion = 17.14.36429.23 VisualStudioVersion = 18.0.11010.61 d18.0
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Admin.NET.Application", "Admin.NET.Application\Admin.NET.Application.csproj", "{C3F5AEC5-ACEE-4109-94E3-3F981DC18268}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Admin.NET.Application", "Admin.NET.Application\Admin.NET.Application.csproj", "{C3F5AEC5-ACEE-4109-94E3-3F981DC18268}"
EndProject EndProject

View File

@ -2,7 +2,7 @@
"name": "admin.net.pro", "name": "admin.net.pro",
"type": "module", "type": "module",
"version": "2.4.33", "version": "2.4.33",
"lastBuildTime": "2025.09.16", "lastBuildTime": "2025.09.17",
"description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架", "description": "Admin.NET 站在巨人肩膀上的 .NET 通用权限开发框架",
"author": "zuohuaijun", "author": "zuohuaijun",
"license": "MIT", "license": "MIT",
@ -81,8 +81,8 @@
"vue-router": "^4.5.1", "vue-router": "^4.5.1",
"vue-signature-pad": "^3.0.2", "vue-signature-pad": "^3.0.2",
"vue3-tree-org": "^4.2.2", "vue3-tree-org": "^4.2.2",
"vxe-pc-ui": "^4.9.30", "vxe-pc-ui": "^4.9.31",
"vxe-table": "^4.16.12", "vxe-table": "^4.16.13",
"xe-utils": "^3.7.9", "xe-utils": "^3.7.9",
"xlsx-js-style": "^1.2.0" "xlsx-js-style": "^1.2.0"
}, },
@ -90,7 +90,7 @@
"@iconify/vue": "^5.0.0", "@iconify/vue": "^5.0.0",
"@plugin-web-update-notification/vite": "^2.0.2", "@plugin-web-update-notification/vite": "^2.0.2",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/node": "^22.18.4", "@types/node": "^22.18.5",
"@types/nprogress": "^0.2.3", "@types/nprogress": "^0.2.3",
"@types/sortablejs": "^1.15.8", "@types/sortablejs": "^1.15.8",
"@typescript-eslint/eslint-plugin": "^8.44.0", "@typescript-eslint/eslint-plugin": "^8.44.0",