修改 在线离线的判断逻辑
This commit is contained in:
@@ -1321,9 +1321,13 @@ namespace RCUHost.Implement
|
||||
DateTime SSS = DateTime.Now;
|
||||
DateTime.TryParse(dtstart, out SSS);
|
||||
TimeSpan ssspan = DateTime.Now - SSS;
|
||||
if (string.IsNullOrEmpty(EEE) && ssspan.TotalMinutes > 5)
|
||||
//var TTT111= CSRedisCacheHelper.Get_Partition<string>(HostNNN,7);
|
||||
//if ((string.IsNullOrEmpty(EEE) && ssspan.TotalMinutes > 5)||string.IsNullOrEmpty(TTT111))
|
||||
//if ((string.IsNullOrEmpty(EEE) && ssspan.TotalMinutes > 5))
|
||||
if (string.IsNullOrEmpty(EEE))
|
||||
{
|
||||
CSRedisCacheHelper.Publish("redis-on_off_line", n);
|
||||
//CSRedisCacheHelper.Set_PartitionWithForever(HostNNN,"1",7);
|
||||
}
|
||||
//6号分区 做离在线数据
|
||||
//但是离线的时候,只能得到Key值
|
||||
@@ -2382,36 +2386,8 @@ namespace RCUHost.Implement
|
||||
///碳达人状态更新
|
||||
if (!string.IsNullOrEmpty(HostID))
|
||||
{
|
||||
string KKey = CacheKey.HostModalStatus_Prefix + "_" + HostID + "_" + "054000001";
|
||||
var OldHostModal = CSRedisCacheHelper.Get_Partition<HostModal_Cache>(KKey);
|
||||
if (OldHostModal != null)
|
||||
{
|
||||
OldHostModal.Status = CarbonVIP;
|
||||
CSRedisCacheHelper.Set_Partition<HostModal_Cache>(KKey, OldHostModal);
|
||||
}
|
||||
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(CacheKey.CarbonVIP_Prefix);
|
||||
sb.Append("_");
|
||||
sb.Append(HostID.ToString());
|
||||
string Key = sb.ToString();
|
||||
|
||||
string current_status_new = "";
|
||||
if (CarbonVIP == 0x01)
|
||||
{
|
||||
current_status_new = "open";
|
||||
}
|
||||
else if (CarbonVIP == 0x02)
|
||||
{
|
||||
current_status_new = "close";
|
||||
}
|
||||
else
|
||||
{
|
||||
current_status_new = "unknow";
|
||||
}
|
||||
|
||||
CSRedisCacheHelper.Set(Key, current_status_new);
|
||||
CarbonVIPReport(HostID, CarbonVIP,"054001000");
|
||||
CarbonVIPReport(HostID, CarbonVIP,"054000001");
|
||||
}
|
||||
|
||||
var DeviceCount = reader.ReadByte();
|
||||
@@ -2757,6 +2733,46 @@ namespace RCUHost.Implement
|
||||
|
||||
}, tuple);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 碳达人上报
|
||||
/// </summary>
|
||||
/// <param name="HostID"></param>
|
||||
/// <param name="CarbonVIP"></param>
|
||||
/// <param name="Address"></param>
|
||||
private static void CarbonVIPReport(string HostID, byte CarbonVIP,string Address)
|
||||
{
|
||||
string KKey = CacheKey.HostModalStatus_Prefix + "_" + HostID + "_" +Address;
|
||||
var OldHostModal = CSRedisCacheHelper.Get_Partition<HostModal_Cache>(KKey);
|
||||
if (OldHostModal != null)
|
||||
{
|
||||
OldHostModal.Status = CarbonVIP;
|
||||
CSRedisCacheHelper.Set_Partition<HostModal_Cache>(KKey, OldHostModal);
|
||||
}
|
||||
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append(CacheKey.CarbonVIP_Prefix);
|
||||
sb.Append("_");
|
||||
sb.Append(HostID.ToString());
|
||||
string Key = sb.ToString();
|
||||
|
||||
string current_status_new = "";
|
||||
if (CarbonVIP == 0x01)
|
||||
{
|
||||
current_status_new = "open";
|
||||
}
|
||||
else if (CarbonVIP == 0x02)
|
||||
{
|
||||
current_status_new = "close";
|
||||
}
|
||||
else
|
||||
{
|
||||
current_status_new = "unknow";
|
||||
}
|
||||
|
||||
CSRedisCacheHelper.Set(Key, current_status_new);
|
||||
}
|
||||
public struct JiNamTongPaiTeShu
|
||||
{
|
||||
public string HostNumber { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user