From 8b2b1622569e92b9b8090cdd52f98457ca62e2fd Mon Sep 17 00:00:00 2001 From: fyf Date: Thu, 12 May 2022 17:47:05 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=A2=9E=E5=8A=A0=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=89=88=E6=9C=AC=E4=B8=8E=E5=BC=80=E5=8F=91=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DataVAPI/ModelDataBus/DataBus.cs | 5 +++++ DataVAPI/Startup.cs | 5 +++++ DataVAPI/UpAndDown/ProcessServer.cs | 5 +++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/DataVAPI/ModelDataBus/DataBus.cs b/DataVAPI/ModelDataBus/DataBus.cs index 18b94c8..3481003 100644 --- a/DataVAPI/ModelDataBus/DataBus.cs +++ b/DataVAPI/ModelDataBus/DataBus.cs @@ -37,6 +37,11 @@ /// 数据库名称 /// public static string dbName = "iotdb"; + + public static string DeviceSecret = "c6a29788702b1146c7850adfbac0bc9a"; + public static string DeviceName = "Transit_Test"; + public static string ProductKey = "grgpECHSL7q"; + #endregion } } diff --git a/DataVAPI/Startup.cs b/DataVAPI/Startup.cs index a43b4d1..6a14728 100644 --- a/DataVAPI/Startup.cs +++ b/DataVAPI/Startup.cs @@ -31,6 +31,11 @@ namespace DataVAPI SugarDb.Conn = Configuration["DbConnectionstring"].ToString(); DataBus.connStr = Configuration["mongoDB.connStr"].ToString(); DataBus.dbName = Configuration["mongoDB.dbName"].ToString(); + + DataBus.DeviceSecret = Configuration["DeviceSecret"].ToString(); + DataBus.DeviceName = Configuration["DeviceName"].ToString(); + DataBus.ProductKey = Configuration["ProductKey"].ToString(); + ProcessServer.Instance.Initialize(); //注册swagger服务 services.AddSwaggerUp(); diff --git a/DataVAPI/UpAndDown/ProcessServer.cs b/DataVAPI/UpAndDown/ProcessServer.cs index 0133780..6cfaacd 100644 --- a/DataVAPI/UpAndDown/ProcessServer.cs +++ b/DataVAPI/UpAndDown/ProcessServer.cs @@ -1,6 +1,7 @@ using DataVApi.Order; using DataVAPI.Controllers; using DataVAPI.Model; +using DataVAPI.ModelDataBus; using DataVAPI.Tool; using DataVAPI.Tool.IOT; using DataVAPI.Tool.控制台显示; @@ -58,9 +59,9 @@ namespace DataVAPI.UpAndDown LoadingShopInformation(); //MQTT 数据接收处理 ConsoleHelper.WriteInfoLine("尝试连接阿里云."); - if (IOTDevServer.GetInstance().CreateLinks("grgpECHSL7q", "Transit", "562dcc779b918a54c2d6589ec30ee230")) + if (IOTDevServer.GetInstance().CreateLinks(DataBus.ProductKey, DataBus.DeviceName, DataBus.DeviceSecret)) + //if (IOTDevServer.GetInstance().CreateLinks("grgpECHSL7q", "Transit", "562dcc779b918a54c2d6589ec30ee230")) { - ConsoleHelper.WriteSuccessLine($"阿里云【Transit】连接成功"); } else