diff --git a/Waste.Application/ThirdApiInfo/OpenService.cs b/Waste.Application/ThirdApiInfo/OpenService.cs index 56cb900..a53a8b0 100644 --- a/Waste.Application/ThirdApiInfo/OpenService.cs +++ b/Waste.Application/ThirdApiInfo/OpenService.cs @@ -21,6 +21,8 @@ namespace Waste.Application.ThirdApiInfo private static string UserId = App.Configuration["SZDevPlatSetting:UserId"]; private static string ApiSecret = App.Configuration["SZDevPlatSetting:ApiSecret"]; private static string ApiSecretHash = App.Configuration["SZDevPlatSetting:ApiSecretHash"]; + private static string WebSocketUrl = App.Configuration["SZDevPlatSetting:SocketUrl"]; + private readonly ISqlSugarRepository repository; private readonly SqlSugarClient dbClient; private readonly ISuZhouService _suZhouService; @@ -88,7 +90,7 @@ namespace Waste.Application.ThirdApiInfo int timestamp = _suZhouService.GetUTCTimestamp(); int noncestr = _suZhouService.GetNonce(); var result = await dbClient.Queryable().FirstAsync(x => x.Id == resultid); - if(result == null) + if (result == null) { return new ResultInfo(ResultState.SUCCESS, "记录id未找到"); } @@ -328,7 +330,7 @@ namespace Waste.Application.ThirdApiInfo var data = new DevRegInfoResponseDto { status = 0, - WebSocketUrl = App.Configuration["SZDevPlatSetting:SocketUrl"] + WebSocketUrl = WebSocketUrl }; //获取授权信息 var devicesecret = await dbClient.Queryable().FirstAsync(x => x.DeviceId == device.Id); diff --git a/Waste.Core/LoggerHelper.cs b/Waste.Core/LoggerHelper.cs index de8c5bf..0dbcaba 100644 --- a/Waste.Core/LoggerHelper.cs +++ b/Waste.Core/LoggerHelper.cs @@ -51,7 +51,7 @@ namespace Waste.Core } if (!string.IsNullOrEmpty(request.Headers["User-Agent"].ToString())) { - diagnosticContext.Set("User-Agent", request.Headers["User-Agent"].ToString()); + diagnosticContext.Set("UserAgent", request.Headers["User-Agent"].ToString()); } if (request.Method == "POST" && request.ContentLength > 0) { diff --git a/Waste.Web.Entry/appsettings.json b/Waste.Web.Entry/appsettings.json index 1f0c9ca..36d6a75 100644 --- a/Waste.Web.Entry/appsettings.json +++ b/Waste.Web.Entry/appsettings.json @@ -35,14 +35,14 @@ "Algorithm": "HS256" // 加密算法,string 类型,默认 SecurityAlgorithms.HmacSha256 }, "logfile": "e:/errlog/waste.ybhdmob.com", //日志文件路径 - //"NirvanaConnection":"Server=localhost,4331;Database=waste;uid=jutian_user;pwd=jutian1qaz@WSX;", "NirvanaConnection": "Server=123.60.2.99,4331;Database=waste;uid=jutian_user;pwd=jutian1qaz@WSX;", - //"SZDevPlatSetting": { //苏州设备接入平台设置,测试环境 - // "ApiUrl": "https://bright.ljflytjl.cn:9101", - // "UserId": "18e76eb9-9154-4b43-bcfe-f80671ab8e79", - // "ApiSecret": "1KXWKC1WA8V8eCDX", - // "ApiSecretHash": "5567485e9458ee89" - //}, + "SZTestDevPlatSetting": { //苏州设备接入平台设置,测试环境 + "ApiUrl": "https://bright.ljflytjl.cn:9101", + "UserId": "18e76eb9-9154-4b43-bcfe-f80671ab8e79", + "ApiSecret": "1KXWKC1WA8V8eCDX", + "ApiSecretHash": "5567485e9458ee89", + "SocketUrl": "wss://bright.ljflytjl.cn:9101/device_rpc" + }, "SZDevPlatSetting": { //苏州设备接入平台设置,正式环境 "ApiUrl": "https://api.data.suzhou.ljflytjl.cn", "UserId": "55863a65-a28c-4e7f-8835-1fa779e1eb9f", diff --git a/WasteConsoleTest/WasteConsoleTest/Program.cs b/WasteConsoleTest/WasteConsoleTest/Program.cs index 5ce18fe..9f54ce2 100644 --- a/WasteConsoleTest/WasteConsoleTest/Program.cs +++ b/WasteConsoleTest/WasteConsoleTest/Program.cs @@ -17,8 +17,9 @@ namespace WasteConsoleTest class Program { private static WSocketClientHelp wSocketClient = null; - public static string Secret = "lsBThmYBYUMrmwkl"; - public static string SecretHash = "bfbaf98fb5b343b2"; + public static string Secret = "0eMqhAjefL0loGhH"; + public static string SecretHash = "d28a95b3d5d85ef0"; + public static string SocketURL = "wss://bright.ljflytjl.cn:9101/device_rpc"; static async Task Main(string[] args) { var builder = new HostBuilder().ConfigureServices((hostContext, services) => @@ -27,7 +28,7 @@ namespace WasteConsoleTest services.AddTransient(); }).UseConsoleLifetime(); var host = builder.Build(); - wSocketClient = new WSocketClientHelp("wss://api.device.suzhou.ljflytjl.cn/device_rpc"); + wSocketClient = new WSocketClientHelp(SocketURL); wSocketClient.OnOpen -= WSocketClient_OnOpen; wSocketClient.OnMessage -= WSocketClient_OnMessage; wSocketClient.OnClose -= WSocketClient_OnClose; diff --git a/WasteConsoleTest/WasteConsoleTest/WSocketClientHelp.cs b/WasteConsoleTest/WasteConsoleTest/WSocketClientHelp.cs index f7df829..de3d2e8 100644 --- a/WasteConsoleTest/WasteConsoleTest/WSocketClientHelp.cs +++ b/WasteConsoleTest/WasteConsoleTest/WSocketClientHelp.cs @@ -13,9 +13,9 @@ namespace WasteConsoleTest ClientWebSocket ws = null; Uri uri = null; bool isUserClose = false;//是否最后由用户手动关闭 - public static string Secret = "lsBThmYBYUMrmwkl"; - public static string SecretHash = "bfbaf98fb5b343b2"; - public static string deviceid = "08d9588d-4796-48f9-8c5b-f28f271b51d0"; + public static string Secret = "0eMqhAjefL0loGhH"; + public static string SecretHash = "d28a95b3d5d85ef0"; + public static string deviceid = "08d954b6-df45-4de1-8fde-f5109798b855"; // /// WebSocket状态