增加 升级功能的 日志监控
This commit is contained in:
@@ -10,6 +10,7 @@ using Common;
|
||||
using Dao;
|
||||
using Domain;
|
||||
using RCUHost.Protocols;
|
||||
using CommonEntity;
|
||||
|
||||
namespace RCUHost.Implement
|
||||
{
|
||||
@@ -30,6 +31,7 @@ namespace RCUHost.Implement
|
||||
public override void Process(ReceiverContext context)
|
||||
{
|
||||
int startIndex = StructConverter.SizeOf(context.SystemHeader);
|
||||
var endpoint = context.RemoteEndPoint.ToString();
|
||||
UpdateHostPacketReply? reply = DecodeUpdateHostPacketReply(context.Data, startIndex);
|
||||
if (reply.HasValue)
|
||||
{
|
||||
@@ -67,6 +69,25 @@ namespace RCUHost.Implement
|
||||
break;
|
||||
}
|
||||
|
||||
var host = updateHostWorker.Host;
|
||||
ShengJi_Log s1 = new ShengJi_Log();
|
||||
s1.hotel_id = host.SysHotel.Code;
|
||||
s1.room_id = host.RoomNumber;
|
||||
s1.device_id = host.HostNumber;
|
||||
|
||||
s1.is_send = 0;
|
||||
s1.udp_raw = context.Data;
|
||||
s1.remote_endpoint = endpoint;
|
||||
s1.md5 = "";
|
||||
s1.partition = 0;
|
||||
s1.file_type = 0;
|
||||
s1.file_path = "";
|
||||
s1.upgrade_state = reply.Value.Status;
|
||||
s1.app_version = reply.Value.Version;
|
||||
|
||||
CSRedisCacheHelper.Publish("redis-up", Newtonsoft.Json.JsonConvert.SerializeObject(s1));
|
||||
|
||||
|
||||
BarData bbb = new BarData();
|
||||
bbb.HostID = updateHostWorker.Host.ID;
|
||||
bbb.Upgrade_status = Upgrade_Status;
|
||||
@@ -97,6 +118,24 @@ namespace RCUHost.Implement
|
||||
Upgrade_Status = "升级失败";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
ShengJi_Log s1 = new ShengJi_Log();
|
||||
s1.hotel_id = host.SysHotel.Code;
|
||||
s1.room_id = host.RoomNumber;
|
||||
s1.device_id = host.HostNumber;
|
||||
|
||||
s1.is_send = 0;
|
||||
s1.udp_raw = context.Data;
|
||||
s1.remote_endpoint = endpoint;
|
||||
s1.md5 = "";
|
||||
s1.partition = 0;
|
||||
s1.file_type = 0;
|
||||
s1.file_path = "";
|
||||
s1.upgrade_state = reply.Value.Status;
|
||||
s1.app_version = reply.Value.Version;
|
||||
CSRedisCacheHelper.Publish("redis-up", Newtonsoft.Json.JsonConvert.SerializeObject(s1));
|
||||
|
||||
BarData bbb = new BarData();
|
||||
bbb.HostID = host.ID;
|
||||
bbb.Upgrade_status = Upgrade_Status;
|
||||
|
||||
@@ -10,6 +10,7 @@ using Common;
|
||||
using Dao;
|
||||
using Domain;
|
||||
using RCUHost.Protocols;
|
||||
using CommonEntity;
|
||||
|
||||
namespace RCUHost.Implement
|
||||
{
|
||||
@@ -221,6 +222,28 @@ namespace RCUHost.Implement
|
||||
byte[] data = CreateUpdateRequestPacket(updateFileMd5, blockNum, fileType, fileName);
|
||||
logger.Error("升级HostNumber为:" + host.HostNumber);
|
||||
logger.Error("升级指令为:" + Tools.ByteToString(data));
|
||||
|
||||
|
||||
ShengJi_Log s1 = new ShengJi_Log();
|
||||
s1.hotel_id = host.SysHotel.Code;
|
||||
s1.room_id = host.RoomNumber;
|
||||
s1.device_id = host.HostNumber;
|
||||
|
||||
s1.is_send = 1;
|
||||
s1.udp_raw = data;
|
||||
string ipAndPort = CSRedisCacheHelper.Get<string>(host.HostNumber, host.MAC);
|
||||
if (!string.IsNullOrEmpty(ipAndPort))
|
||||
{
|
||||
s1.remote_endpoint = ipAndPort;
|
||||
}
|
||||
s1.md5 = updateFileMd5;
|
||||
s1.partition = blockNum;
|
||||
s1.file_type = fileType;
|
||||
s1.file_path = fileName;
|
||||
s1.upgrade_state = 0;
|
||||
s1.app_version = host.Version;
|
||||
CSRedisCacheHelper.Publish("redis-up", Newtonsoft.Json.JsonConvert.SerializeObject(s1));
|
||||
|
||||
Send(data, host.HostNumber, host.MAC);// host.IP, host.Port);
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user