添加调试信息和数据库查询

如题
This commit is contained in:
tianshuanbao
2025-12-17 09:59:02 +08:00
parent 5c949a6ce2
commit 4b15524845
4 changed files with 37 additions and 2 deletions

View File

@@ -13,6 +13,7 @@
<ItemGroup>
<ProjectReference Include="..\Commonlib\Commonlib.csproj" />
<ProjectReference Include="..\LogCap\LogCap.csproj" />
</ItemGroup>
</Project>

View File

@@ -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<byte> IP3 = data.Skip(13).Take(1).ToList();
List<byte> 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<byte>(),"",300,"02");
}
static void Main(string[] args)
{
testa();
Console.ReadLine();
ReadData();
var B = "33\\343\\22";
var AAA = Path.Combine("", $"{B}");

View File

@@ -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<List<MonitorEndPoint>>(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<byte> data, string source_ip, ushort source_port, string cmdtype, string Send_Or_Receive = ConstKey.Receive_RX)
public static void ReallyDealWith(bool isRegister, List<byte> 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<List<Monitor_Host>>(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<MonitorRedis>(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<string>(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;

View File

@@ -17,6 +17,7 @@
<ItemGroup>
<PackageReference Include="CSRedisCore" Version="3.8.803" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.1.3" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />