增加很多功能

增加几个日志监控功能
This commit is contained in:
2026-03-19 11:55:00 +08:00
parent f4d67cb673
commit 0aa223d891
7 changed files with 105 additions and 20 deletions

View File

@@ -522,13 +522,13 @@ namespace BLWLogProduce.Services
{
NewVersionLog? poo = System.Text.Json.JsonSerializer.Deserialize<NewVersionLog>(body);
poo.ts_ms = Tools.GetUnixTime_MS();
if (poo.hotel_id.Equals("2144")&&poo.room_id.Equals("1006")||poo.room_id.Equals("1007"))
if (poo.hotel_id.Equals("2144") && poo.room_id.Equals("1006") || poo.room_id.Equals("1007"))
{
logger.Error("漏数据监控:"+poo.room_id+"##"+poo.comm_seq);
logger.Error("漏数据监控:" + poo.room_id + "##" + poo.comm_seq);
}
if (poo.hotel_id.Equals("1085")&&poo.room_id.Equals("8099"))
if (poo.hotel_id.Equals("1085") && poo.room_id.Equals("8099"))
{
logger.Error("漏数据监控:"+poo.room_id+"##"+poo.comm_seq);
logger.Error("漏数据监控:" + poo.room_id + "##" + poo.comm_seq);
}
if (string.IsNullOrEmpty(poo.hotel_id) || string.IsNullOrEmpty(poo.device_id))
@@ -566,8 +566,10 @@ namespace BLWLogProduce.Services
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex.StackTrace);
logger.Error("注册日志错误:" + body);
logger.Error(ex.Message);
logger.Error(ex.StackTrace);
}
}));
@@ -581,7 +583,7 @@ namespace BLWLogProduce.Services
{
RegisterInfo? poo = System.Text.Json.JsonSerializer.Deserialize<RegisterInfo>(body);
string TopicKey1 = KafkaKey.blwlog4Nodejs_rcu_register_topic;
string DetailKey1 =poo.device_id;
string DetailKey1 = poo.device_id;
var jsonstr = JsonConvert.SerializeObject(poo);
await p.ProduceAsync(TopicKey1, new Message<string, byte[]> { Key = DetailKey1, Value = Encoding.UTF8.GetBytes(jsonstr) });
@@ -589,11 +591,38 @@ namespace BLWLogProduce.Services
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
Console.WriteLine(ex.StackTrace);
logger.Error("注册日志错误:" + body);
logger.Error(ex.Message);
logger.Error(ex.StackTrace);
}
}));
//注册0xB1
var TSLog_DingYue_ShengJi = ("redis-up", new Action<SubscribeMessageEventArgs>(async (args) =>
{
string body = args.Body;
try
{
ShengJi_Log poo = System.Text.Json.JsonSerializer.Deserialize<ShengJi_Log>(body);
poo.ts_ms= Tools.GetUnixTime_MS();
string TopicKey1 = KafkaKey.blwlog4Nodejs_rcu_upgrade_topic;
string DetailKey1 = poo.hotel_id;
var jsonstr = JsonConvert.SerializeObject(poo);
await p.ProduceAsync(TopicKey1, new Message<string, byte[]> { Key = DetailKey1, Value = Encoding.UTF8.GetBytes(jsonstr) });
}
catch (Exception ex)
{
logger.Error("升级日志错误:" + body);
logger.Error(ex.Message);
logger.Error(ex.StackTrace);
}
}));
var TSLog_DingYue_0X36 = ("redis-0X36-0X0F", new Action<SubscribeMessageEventArgs>(async (args) =>
{
@@ -865,7 +894,7 @@ namespace BLWLogProduce.Services
MAC = usa.MAC,
RoomNumber = usa.RoomNumber,
EndPoint = usa.RemoteEndPoint,
CurrentStatus = usa.CurrentStatus,
CurrentStatus ="restart",
CurrentTime = usa.CurrentTime,
UnixTime = Tools.GetUnixTime_MS(),
LauncherVersion = usa.LauncherVersion,
@@ -1043,6 +1072,7 @@ namespace BLWLogProduce.Services
CSRedisCacheHelper.redis3.Subscribe(DingYue11);
CSRedisCacheHelper.redis3.Subscribe(TSLog_DingYue_XinTiao);
CSRedisCacheHelper.redis3.Subscribe(TSLog_DingYue_ZhuCe);
CSRedisCacheHelper.redis3.Subscribe(TSLog_DingYue_ShengJi);
}
catch (Exception ex)
{

View File

@@ -0,0 +1,16 @@
using Microsoft.Extensions.Caching.Memory;
namespace BLWLogProduce.Services
{
public class MyCache
{
public IConfiguration Configuration { get; set; }
public IMemoryCache _Cache { get; set; }
public MyCache(IConfiguration configuration, IMemoryCache cache)
{
this.Configuration = configuration;
_Cache = cache;
}
}
}