diff --git a/ConsoleApp2/ConsoleApp2.csproj b/ConsoleApp2/ConsoleApp2.csproj index 0677407..c9a898d 100644 --- a/ConsoleApp2/ConsoleApp2.csproj +++ b/ConsoleApp2/ConsoleApp2.csproj @@ -13,6 +13,7 @@ + diff --git a/ConsoleApp2/Program.cs b/ConsoleApp2/Program.cs index 1fc983e..ac3da51 100644 --- a/ConsoleApp2/Program.cs +++ b/ConsoleApp2/Program.cs @@ -3,6 +3,7 @@ using System.Transactions; using Common; using Commonlib; using LiteDB; +using LogCap.Common; namespace ConsoleApp2 { @@ -31,9 +32,16 @@ namespace ConsoleApp2 List IP3 = data.Skip(13).Take(1).ToList(); List IP4 = data.Skip(14).Take(1).ToList(); } + static void testa() + { + byte[] nnn = Tools.HEXString2ByteArray("AA 55 11 00 54 33 53 41 02 1E FE AD 04 01 9A 23 76".Replace(" ","")); + DealWithData.ReallyDealWith(true,nnn.ToList(),"",300,"02"); + } static void Main(string[] args) { + testa(); + Console.ReadLine(); ReadData(); var B = "33\\343\\22"; var AAA = Path.Combine("", $"{B}"); diff --git a/LogCap/Common/DealWithData.cs b/LogCap/Common/DealWithData.cs index ef749fd..7933843 100644 --- a/LogCap/Common/DealWithData.cs +++ b/LogCap/Common/DealWithData.cs @@ -10,6 +10,7 @@ using Common; using Commonlib; using LogCap.Entity; using MathNet.Numerics.Distributions; +using Microsoft.Data.SqlClient; using Microsoft.Extensions.Caching.Memory; using Newtonsoft.Json; using NLog; @@ -69,7 +70,7 @@ namespace LogCap.Common var QQQSSS = Program.Cache.Get>(CacheKey.MonitorEndPointList); - if (QQQSSS.Count > 0) + if (QQQSSS?.Count > 0) { string S_R_Type = ""; @@ -269,7 +270,7 @@ namespace LogCap.Common } } - private static void ReallyDealWith(bool isRegister, List data, string source_ip, ushort source_port, string cmdtype, string Send_Or_Receive = ConstKey.Receive_RX) + public static void ReallyDealWith(bool isRegister, List data, string source_ip, ushort source_port, string cmdtype, string Send_Or_Receive = ConstKey.Receive_RX) { try { @@ -285,8 +286,15 @@ namespace LogCap.Common { return; } + long HHH = context.SystemHeader.Value.HostNumber.ToHotelCode(); var list = Program.Cache.Get>(CacheKey.Key); + + if (HHH == 1197) + { + //Console.WriteLine("data:" + Tools.ByteToString(data.ToArray())); + //Console.WriteLine(JsonConvert.SerializeObject(list)); + } if (list == null) { return; @@ -349,6 +357,11 @@ namespace LogCap.Common if (HostNNN.Equals(Ghostnumber)) { + if (HHH == 1197) + { + //Console.WriteLine("111111 "+isRegister); + //Console.WriteLine("111111 data:" + Tools.ByteToString(data.ToArray())); + } //心跳包可以注册 if (isRegister) { @@ -360,6 +373,11 @@ namespace LogCap.Common string Key = string.Format("{0}_{1}", CacheKey.RoomIP_Port_Prefix, HostNNN); var takeMM = Program.Cache.Get(Key); + + if (HHH == 1197) + { + //Console.WriteLine("1197::::"+JsonConvert.SerializeObject(takeMM)); + } //如果房间为空 if (takeMM == null) { @@ -379,6 +397,9 @@ namespace LogCap.Common } else { + //SqlConnection con = new SqlConnection(""); + //con.Open(); + sttr = Send_Http_Request_Params("api/GetHostByMAC_POST", dic); Program.Cache.Set(KKK, GGG, new MemoryCacheEntryOptions() { @@ -448,6 +469,10 @@ namespace LogCap.Common } else { + if (hotelcode.Equals("1197")) + { + Console.WriteLine("upload data"); + } long hotel_code = takeMM.HotelCode; int host_id = takeMM.HostID; diff --git a/LogCap/LogCap.csproj b/LogCap/LogCap.csproj index 5ad4666..764ffdf 100644 --- a/LogCap/LogCap.csproj +++ b/LogCap/LogCap.csproj @@ -17,6 +17,7 @@ +