增加日志

This commit is contained in:
2026-02-04 18:05:46 +08:00
parent 1d77141ffe
commit 6196311cb7
7 changed files with 118 additions and 17 deletions

Binary file not shown.

View File

@@ -20,6 +20,7 @@ namespace Common
public static CSRedisClient redis3;
public static CSRedisClient redis4;
public static CSRedisClient redis5;
public static CSRedisClient redis6;
public static CSRedisClient redis_webchat;
//private static readonly string[] redisHosts = null;
private static int SessionExpireMinutes = int.Parse(ConfigurationManager.AppSettings["session_expire_minutes"]);
@@ -57,7 +58,7 @@ namespace Common
redis4 = new CSRedisClient(redisHostStr + ",password=,defaultDatabase=4");
redis5 = new CSRedisClient(redisHostStr + ",password=,defaultDatabase=5");
redis5 = new CSRedisClient(redisHostStr + ",password=,defaultDatabase=5");
redis6 = new CSRedisClient(redisHostStr + ",password=,defaultDatabase=6");
redis_webchat = new CSRedisClient(string.Format(webchat_redisstr + ",password={0},defaultDatabase=0",webchat_redis_pwd));
//Native subscribe
@@ -200,6 +201,10 @@ namespace Common
{
client = redis5;
}
else if (SliceNo == 6)
{
client = redis6;
}
else
{
client = redis;

View File

@@ -22,6 +22,12 @@ namespace CommonEntity
public string RemoteEndPoint { get; set; }
public string HexData { get; set; }
public DateTime CurrentTime { get; set; }
public string MAC { get; set; }
public string CurrentStatus { get; set; }
public long UnixTime { get; set; }
public byte[] LauncherVersion { get; set; }
public byte[] RebootReason { get; set; }
}
/// <summary>
/// 新版本的设备状态

View File

@@ -306,6 +306,7 @@ namespace ConsoleApplication2
#endif
var ggg= BitConverter.ToString(new byte[]{0xaa,0xcc});
AAA();
string aaa111 = "233003";
var bj1 = aaa111.Substring(0, 3);

View File

@@ -1280,13 +1280,14 @@ namespace RCUHost.Implement
o.CurrentTime = DateTime.Now;
o.EndPoint = EndPointStr;
o.UnixTime = Tools.GetUnixTime();
o.MAC = BitConverter.ToString(gga.Data.Skip(9).Take(2).ToArray());
//新来的数据
var n = Newtonsoft.Json.JsonConvert.SerializeObject(o);
//上线
//string EEE = CSRedisCacheHelper.Get<string>(EndPointStr);
var EEE = CSRedisCacheHelper.Get_Partition<string>(EndPointStr, 4);
var EEE = CSRedisCacheHelper.Get_Partition<string>(EndPointStr, 6);
var dtstart = CSRedisCacheHelper.ForeverGet<string>(CacheKey.ServerStartTime);
DateTime SSS = DateTime.Now;
DateTime.TryParse(dtstart, out SSS);
@@ -1295,7 +1296,8 @@ namespace RCUHost.Implement
{
CSRedisCacheHelper.Publish("redis-on_off_line", n);
}
CSRedisCacheHelper.Set_PartitionWithTime(EndPointStr, n, 5, 4);
CSRedisCacheHelper.Set_PartitionWithTime(EndPointStr, n, 5, 6);
CSRedisCacheHelper.Set_PartitionWithTime(EndPointStr, n, 20, 4);
@@ -1713,9 +1715,14 @@ namespace RCUHost.Implement
int length = context111.Data.Length - offset - 2;
var data = OriginalByte.Skip(offset).ToArray();
var LauncherVersion = data.Take(20);
var RestartReason = data.Skip(20).Take(1);
var LauncherVersion = data.Take(20).ToArray();
var RestartReason = data.Skip(20).Take(1).ToArray();
string RoomNUMBER = CSRedisCacheHelper.HMGet<string>(5, CacheKey.RoomNumber_HostNumber, HostNNN)[0];
if (string.IsNullOrEmpty(RoomNUMBER))
{
return;
}
NewVersionHexData ns = new NewVersionHexData();
ns.CmdType = 0x33;
ns.HotelCode = hotelCode;
@@ -1723,9 +1730,17 @@ namespace RCUHost.Implement
ns.RemoteEndPoint = EndPoint;
ns.CurrentTime = DateTime.Now;
ns.HexData = Tools.ByteToString(context111.Data);
ns.RoomNumber = RoomNUMBER;
ns.MAC = BitConverter.ToString(OriginalByte.Skip(9).Take(2).ToArray());
ns.CurrentStatus = "on";
ns.UnixTime = Tools.GetUnixTime();
ns.LauncherVersion = LauncherVersion;
ns.RebootReason = RestartReason;
string mns1 = Newtonsoft.Json.JsonConvert.SerializeObject(ns);
CSRedisCacheHelper.Publish("redis-rcu-restart", mns1);
}
#region
if (cmdType == 0x35)
{
ReplyWithContent(context111, new byte[] { 0x00 }, framenolist);
@@ -1806,6 +1821,7 @@ namespace RCUHost.Implement
}
}
}
#endregion
// AA 55 35 00 54 33 53 41 34 10 80 EB 03 6B 24
// 01 //协议版本
@@ -1843,6 +1859,7 @@ namespace RCUHost.Implement
//P30~P33通道总能耗单位Wh1度电 = 1KWh
#region
if (cmdType == 0x36)
{
@@ -1937,6 +1954,9 @@ namespace RCUHost.Implement
//ns.HexData = Tools.ByteToString(context111.Data);
//CSRedisCacheHelper.Publish("redis-rcu-hexdata", Newtonsoft.Json.JsonConvert.SerializeObject(ns));
}
#endregion
#region
if (cmdType == 0x34)
{
ReplyWithContent(context111, new byte[] { 0x00 }, framenolist);
@@ -2540,6 +2560,7 @@ namespace RCUHost.Implement
logger.Error("定是上报出错:" + ex.StackTrace);
}
}
#endregion
//向服务器获取房态
if (cmdType == 0x32)

View File

@@ -157,7 +157,7 @@ namespace RCUHost.Implement
//来一个数据,把所有的地址拼接起来
string YiJingChuLiGuo = CacheKey.AllReadyDealWith0E_Prefix + "_" + HostNumberOnly;
MemoryCacheHelper.Delete(YiJingChuLiGuo);
ProcessModal_NEW_NEW(host, status.Devices, isTriggerWelcomeMsg, context.MessageID, context.IsMonitor);//更新灯光及其他回路状态
ProcessModal_NEW_NEW(host, status.Devices, isTriggerWelcomeMsg, context.MessageID, context.IsMonitor, context.Data, status);//更新灯光及其他回路状态
string nnn = VVV1 + VVV2;
if (!string.IsNullOrEmpty(nnn))
{
@@ -224,7 +224,7 @@ namespace RCUHost.Implement
public static string Missionsys_Address = ConfigurationManager.AppSettings["missionsys_address"];
public static string MQTTInfo_report_url = ConfigurationManager.AppSettings["debug_log_report_url"].ToString();
private void ProcessModal_NEW_NEW(Host host, ConcurrentDictionary<string, Device> devices, bool IsTriggerWelcomeMsg, string ContextMessageId, bool ismonitor)
private void ProcessModal_NEW_NEW(Host host, ConcurrentDictionary<string, Device> devices, bool IsTriggerWelcomeMsg, string ContextMessageId, bool ismonitor, byte[] OriginalByteList, Status yuanshidata)
{
string UUID = "9dc6a0ee-dcf1-4385-b05f-09cb463838cd";
UUID = host.FCS_locationUUID;
@@ -257,6 +257,9 @@ namespace RCUHost.Implement
bool isInsert = false;
StepTongJi.SendInfo(4.3, "Task开始执行设备信息处理", ContextMessageId, ismonitor);
List<ts_deviceitem> shebei_changeaction_list = new List<ts_deviceitem>();
List<ts_faultitem> exception_list = new List<ts_faultitem>();
//StringBuilder sbSQL;
foreach (var device in devices)
{
@@ -1845,9 +1848,26 @@ namespace RCUHost.Implement
}
#endregion
//0关闭设备
//1打开设备且当前设备处于关闭状态
//2打开设备且当前设备处于打开状态
if (flag == 0 || flag == 1)
{
ts_deviceitem t1 = new ts_deviceitem();
string dizhi = device.Value.Address;
t1.dev_type = short.Parse(dizhi.Substring(0, 3));
t1.dev_addr = short.Parse(dizhi.Substring(3, 3));
t1.dev_loop = short.Parse(dizhi.Substring(6, 3));
t1.dev_data = device.Value.StatusReceiver;
shebei_changeaction_list.Add(t1);
}
#region
if ((flag == 0 || flag == 1) && (!string.IsNullOrEmpty(host.SysHotel.DeviceStatusPushURL)))
{
if (host.SysHotel.DeviceStatusPushURL.ToLower().IndexOf("wangjile") > -1)//freego过滤
{
switch (hostModal.Modal.ModalAddress)
@@ -1892,18 +1912,12 @@ namespace RCUHost.Implement
}
MyHttp.SendHttpData(ttt.Item1.SysHotel.DeviceStatusPushURL, resp);
//string Key = "HttpRequest_" + resp.code + "_" + resp.roomNumber;
//var Data = MemoryCacheHelper.Get(Key);
//if (Data != null)
//{
//}
//else
//{
// //XuanZhuOperation.ReportService(ttt.Item1.SysHotel.DeviceStatusPushURL, resp);
//}
}, tup);
}
#endregion
@@ -1940,6 +1954,7 @@ namespace RCUHost.Implement
CSRedisCacheHelper.Publish("Redis-XuanZhuKafka", str111);
}
#endregion
}
else
{
@@ -1952,6 +1967,55 @@ namespace RCUHost.Implement
}
}
#region
byte[] OriginalByte = OriginalByteList;
DeviceActionData d1 = new DeviceActionData();
d1.ts_ms = Tools.GetUnixTime();
d1.hotel_id = HOTEL_CODE;
d1.room_id = ROOMNUMBER;
d1.device_id = HOSTNUMBER;
d1.frame_id = frameNo;
d1.cmd_word = "0E";
d1.udp_raw = OriginalByte;
d1.direction = "上报";
if (yuanshidata.SysLock)
{
d1.sys_lock_status = 1;
}
else
{
d1.sys_lock_status = 2;
}
if (yuanshidata.Faults != null && yuanshidata.Faults.Count > 0)
{
var F1 = yuanshidata.Faults;
foreach (var item in F1)
{
string dizhi = item.Value.FaultNo;
ts_faultitem t1 = new ts_faultitem();
t1.dev_type = short.Parse(dizhi.Substring(0, 3));
t1.dev_addr = short.Parse(dizhi.Substring(3, 3));
t1.dev_loop = short.Parse(dizhi.Substring(6, 3));
t1.error_type = item.Value.Type;
t1.error_data = item.Value.Data;
exception_list.Add(t1);
}
}
d1.device_list = shebei_changeaction_list;
d1.fault_list = exception_list;
d1.report_count = shebei_changeaction_list.Count;
d1.fault_count = exception_list.Count;
string sss111 = Newtonsoft.Json.JsonConvert.SerializeObject(d1);
CSRedisCacheHelper.Publish("redis-0X36-0X0F", sss111);
#endregion
StepTongJi.SendInfo(5, "Task中的设备处理代码执行完毕", ContextMessageId, ismonitor);
devices.Clear();
}

View File

@@ -599,6 +599,8 @@ namespace WebSite.Controllers
/// </summary>
/// <param name="jsonData"></param>
/// <returns></returns>
//public ActionResult GetRoomAirList_Deprecate(string jsonData)
public ActionResult GetRoomAirList(string jsonData)
{
//return Json(new { IsSuccess = false, Result = "接口修改调整" }, JsonRequestBehavior.AllowGet);
@@ -927,6 +929,7 @@ namespace WebSite.Controllers
/// </summary>
/// <param name="jsonData"></param>
/// <returns></returns>
//public ActionResult GetRoomLightList_Deprecate(string jsonData)
public ActionResult GetRoomLightList(string jsonData)
{
@@ -1059,6 +1062,7 @@ namespace WebSite.Controllers
/// </summary>
/// <param name="jsonData"></param>
/// <returns></returns>
//public ActionResult GetRoomCurtainList_Deprecate(string jsonData)
public ActionResult GetRoomCurtainList(string jsonData)
{