From f24daad03eb544f4c121076283b5bac5a7d4810c Mon Sep 17 00:00:00 2001 From: zhangbin <460190368@qq.com> Date: Sat, 12 Jul 2025 15:07:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ServiceApp/AirportMaintenanceApp.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/OpenAuth.App/ServiceApp/AirportMaintenanceApp.cs b/OpenAuth.App/ServiceApp/AirportMaintenanceApp.cs index 607514c..6dcc53c 100644 --- a/OpenAuth.App/ServiceApp/AirportMaintenanceApp.cs +++ b/OpenAuth.App/ServiceApp/AirportMaintenanceApp.cs @@ -14,15 +14,16 @@ using DocumentFormat.OpenXml.EMMA; using NPOI.SS.Formula.Functions; using Infrastructure.Extensions; using DocumentFormat.OpenXml.Math; -using DocumentFormat.OpenXml.Spreadsheet; -using Org.BouncyCastle.Ocsp; +using Microsoft.Extensions.Configuration; namespace OpenAuth.App.ServiceApp { public class AirportMaintenanceApp : SqlSugarBaseApp { - public AirportMaintenanceApp(ISugarUnitOfWork unitWork, ISimpleClient repository, IAuth auth) : base(unitWork, repository, auth) + private readonly IConfiguration _configuration; + public AirportMaintenanceApp(ISugarUnitOfWork unitWork, IConfiguration configuration, ISimpleClient repository, IAuth auth) : base(unitWork, repository, auth) { + _configuration = configuration; } //获取设备绑定码 public async Task> GetDeviceBindingCode() @@ -115,15 +116,19 @@ namespace OpenAuth.App.ServiceApp } else { + var serverIp = _configuration.GetSection("MQTT:Server").Value; + var port = _configuration.GetSection("MQTT:Port").Value; + var username = _configuration.GetSection("MQTT:UserName").Value; + var password = _configuration.GetSection("MQTT:Password").Value; //如果网关不存在,则创建一个新的 var newGateway = new LasaGateway { Id = Guid.NewGuid().ToString(), CreateTime = DateTime.Now, - GatewayAccount = "sdhc", + GatewayAccount = username, GatewaySn = Guid.NewGuid().ToString("N").Substring(0, 8).ToUpper(), // 生成一个新的 - MqttGateway = "175.27.168.120:6011", - MqttPassword = "", + MqttGateway = serverIp + ":" + port, + MqttPassword = password, OrgId = "371300", // 默认组织ID BindStatus = 0 // 未绑定状态 }; @@ -316,7 +321,7 @@ namespace OpenAuth.App.ServiceApp var list = await db.LasaLog.AsQueryable() .Where(x => x.CreateTime >= startTime && x.CreateTime <= endTime) .Where(x => x.Topic == topic) - .OrderBy(x => x.CreateTime, OrderByType.Asc) + .OrderBy(x => x.CreateTime, OrderByType.Asc) .ToPageListAsync(page, limit, totalCount); return new Response>> {