增加测量环境和正常环境切换

This commit is contained in:
Hinse 2021-08-14 09:32:46 +08:00
parent 7ddff1b1a6
commit ee8ca6596d
5 changed files with 19 additions and 16 deletions

View File

@ -21,6 +21,8 @@ namespace Waste.Application.ThirdApiInfo
private static string UserId = App.Configuration["SZDevPlatSetting:UserId"]; private static string UserId = App.Configuration["SZDevPlatSetting:UserId"];
private static string ApiSecret = App.Configuration["SZDevPlatSetting:ApiSecret"]; private static string ApiSecret = App.Configuration["SZDevPlatSetting:ApiSecret"];
private static string ApiSecretHash = App.Configuration["SZDevPlatSetting:ApiSecretHash"]; private static string ApiSecretHash = App.Configuration["SZDevPlatSetting:ApiSecretHash"];
private static string WebSocketUrl = App.Configuration["SZDevPlatSetting:SocketUrl"];
private readonly ISqlSugarRepository<W_Device> repository; private readonly ISqlSugarRepository<W_Device> repository;
private readonly SqlSugarClient dbClient; private readonly SqlSugarClient dbClient;
private readonly ISuZhouService _suZhouService; private readonly ISuZhouService _suZhouService;
@ -88,7 +90,7 @@ namespace Waste.Application.ThirdApiInfo
int timestamp = _suZhouService.GetUTCTimestamp(); int timestamp = _suZhouService.GetUTCTimestamp();
int noncestr = _suZhouService.GetNonce(); int noncestr = _suZhouService.GetNonce();
var result = await dbClient.Queryable<W_Result>().FirstAsync(x => x.Id == resultid); var result = await dbClient.Queryable<W_Result>().FirstAsync(x => x.Id == resultid);
if(result == null) if (result == null)
{ {
return new ResultInfo(ResultState.SUCCESS, "记录id未找到"); return new ResultInfo(ResultState.SUCCESS, "记录id未找到");
} }
@ -328,7 +330,7 @@ namespace Waste.Application.ThirdApiInfo
var data = new DevRegInfoResponseDto var data = new DevRegInfoResponseDto
{ {
status = 0, status = 0,
WebSocketUrl = App.Configuration["SZDevPlatSetting:SocketUrl"] WebSocketUrl = WebSocketUrl
}; };
//获取授权信息 //获取授权信息
var devicesecret = await dbClient.Queryable<W_SZDevice>().FirstAsync(x => x.DeviceId == device.Id); var devicesecret = await dbClient.Queryable<W_SZDevice>().FirstAsync(x => x.DeviceId == device.Id);

View File

@ -51,7 +51,7 @@ namespace Waste.Core
} }
if (!string.IsNullOrEmpty(request.Headers["User-Agent"].ToString())) 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) if (request.Method == "POST" && request.ContentLength > 0)
{ {

View File

@ -35,14 +35,14 @@
"Algorithm": "HS256" // string SecurityAlgorithms.HmacSha256 "Algorithm": "HS256" // string SecurityAlgorithms.HmacSha256
}, },
"logfile": "e:/errlog/waste.ybhdmob.com", // "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;", "NirvanaConnection": "Server=123.60.2.99,4331;Database=waste;uid=jutian_user;pwd=jutian1qaz@WSX;",
//"SZDevPlatSetting": { //, "SZTestDevPlatSetting": { //,
// "ApiUrl": "https://bright.ljflytjl.cn:9101", "ApiUrl": "https://bright.ljflytjl.cn:9101",
// "UserId": "18e76eb9-9154-4b43-bcfe-f80671ab8e79", "UserId": "18e76eb9-9154-4b43-bcfe-f80671ab8e79",
// "ApiSecret": "1KXWKC1WA8V8eCDX", "ApiSecret": "1KXWKC1WA8V8eCDX",
// "ApiSecretHash": "5567485e9458ee89" "ApiSecretHash": "5567485e9458ee89",
//}, "SocketUrl": "wss://bright.ljflytjl.cn:9101/device_rpc"
},
"SZDevPlatSetting": { //, "SZDevPlatSetting": { //,
"ApiUrl": "https://api.data.suzhou.ljflytjl.cn", "ApiUrl": "https://api.data.suzhou.ljflytjl.cn",
"UserId": "55863a65-a28c-4e7f-8835-1fa779e1eb9f", "UserId": "55863a65-a28c-4e7f-8835-1fa779e1eb9f",

View File

@ -17,8 +17,9 @@ namespace WasteConsoleTest
class Program class Program
{ {
private static WSocketClientHelp wSocketClient = null; private static WSocketClientHelp wSocketClient = null;
public static string Secret = "lsBThmYBYUMrmwkl"; public static string Secret = "0eMqhAjefL0loGhH";
public static string SecretHash = "bfbaf98fb5b343b2"; public static string SecretHash = "d28a95b3d5d85ef0";
public static string SocketURL = "wss://bright.ljflytjl.cn:9101/device_rpc";
static async Task Main(string[] args) static async Task Main(string[] args)
{ {
var builder = new HostBuilder().ConfigureServices((hostContext, services) => var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
@ -27,7 +28,7 @@ namespace WasteConsoleTest
services.AddTransient<IMyService, MyService>(); services.AddTransient<IMyService, MyService>();
}).UseConsoleLifetime(); }).UseConsoleLifetime();
var host = builder.Build(); var host = builder.Build();
wSocketClient = new WSocketClientHelp("wss://api.device.suzhou.ljflytjl.cn/device_rpc"); wSocketClient = new WSocketClientHelp(SocketURL);
wSocketClient.OnOpen -= WSocketClient_OnOpen; wSocketClient.OnOpen -= WSocketClient_OnOpen;
wSocketClient.OnMessage -= WSocketClient_OnMessage; wSocketClient.OnMessage -= WSocketClient_OnMessage;
wSocketClient.OnClose -= WSocketClient_OnClose; wSocketClient.OnClose -= WSocketClient_OnClose;

View File

@ -13,9 +13,9 @@ namespace WasteConsoleTest
ClientWebSocket ws = null; ClientWebSocket ws = null;
Uri uri = null; Uri uri = null;
bool isUserClose = false;//是否最后由用户手动关闭 bool isUserClose = false;//是否最后由用户手动关闭
public static string Secret = "lsBThmYBYUMrmwkl"; public static string Secret = "0eMqhAjefL0loGhH";
public static string SecretHash = "bfbaf98fb5b343b2"; public static string SecretHash = "d28a95b3d5d85ef0";
public static string deviceid = "08d9588d-4796-48f9-8c5b-f28f271b51d0"; public static string deviceid = "08d954b6-df45-4de1-8fde-f5109798b855";
// <summary> // <summary>
/// WebSocket状态 /// WebSocket状态