有恶意请求,增加恶意请求的拦截
如题
This commit is contained in:
@@ -1135,41 +1135,31 @@ namespace RCUHost.Implement
|
||||
if (list.Count > 0 && hostModals.Count > 0)
|
||||
{
|
||||
System.Reflection.PropertyInfo[] properties = typeof(HotelSeason).GetProperties();//获取所有属性
|
||||
Host pa = new Host();
|
||||
pa.HostNumber = host.HostNumber;
|
||||
pa.MAC = host.MAC;
|
||||
foreach (HotelAirControl item in list)
|
||||
{
|
||||
foreach (System.Reflection.PropertyInfo prop in properties)//遍历属性
|
||||
{
|
||||
if (prop.Name == "Month" + DateTime.Now.Month.ToString() && Convert.ToInt16(prop.GetValue(hotelSeason, null)) == item.Season)//当前月份所属该季节,则发送命令给rcu设置空调
|
||||
{
|
||||
var VA = new Tuple<List<HostModal>,HotelAirControl,Host>(hostModals,item,pa);
|
||||
Task.Factory.StartNew((state) =>
|
||||
{
|
||||
var UUU =state as Tuple<List<HostModal>, HotelAirControl,Host>;
|
||||
System.Threading.Thread.Sleep(item.DelayTime * 1000);//延迟执行
|
||||
System.Threading.Thread.Sleep(item.DelayTime * 1000);//延迟执行
|
||||
|
||||
var D1 = UUU.Item1;
|
||||
var D2 = UUU.Item2;
|
||||
var D3 = UUU.Item3;
|
||||
foreach (HostModal hostModal1 in D1)
|
||||
{
|
||||
Device device1 = new Device();
|
||||
device1.Address = hostModal1.Modal.ModalAddress;
|
||||
device1.AddressType = AddressType.DeviceAddress;
|
||||
device1.Type = DeviceType.AirConditioner;
|
||||
device1.Status = (byte)D2.Status;
|
||||
device1.Brightness = 0;
|
||||
device1.Temperature = (byte)D2.SettingTemp;
|
||||
device1.FanSpeed = (byte)D2.FanSpeed;
|
||||
device1.Mode = (byte)D2.Mode;
|
||||
device1.Valve = 0;
|
||||
device1.AirExecMode = (D2.Status << 14) + (D2.Mode << 12) + (D2.FanSpeed << 10) + (0 << 8) + D2.SettingTemp;//空调执行方式和内容
|
||||
//这里只需要host的mac和number或者 ip
|
||||
DeviceControlReceiver.Send(D3, device1);
|
||||
}
|
||||
},VA);
|
||||
var D2 = item;
|
||||
foreach (HostModal hostModal1 in hostModals)
|
||||
{
|
||||
Device device1 = new Device();
|
||||
device1.Address = hostModal1.Modal.ModalAddress;
|
||||
device1.AddressType = AddressType.DeviceAddress;
|
||||
device1.Type = DeviceType.AirConditioner;
|
||||
device1.Status = (byte)D2.Status;
|
||||
device1.Brightness = 0;
|
||||
device1.Temperature = (byte)D2.SettingTemp;
|
||||
device1.FanSpeed = (byte)D2.FanSpeed;
|
||||
device1.Mode = (byte)D2.Mode;
|
||||
device1.Valve = 0;
|
||||
device1.AirExecMode = (D2.Status << 14) + (D2.Mode << 12) + (D2.FanSpeed << 10) + (0 << 8) + D2.SettingTemp;//空调执行方式和内容
|
||||
//这里只需要host的mac和number或者 ip
|
||||
DeviceControlReceiver.Send(host, device1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1862,8 +1852,18 @@ namespace RCUHost.Implement
|
||||
resp.fanSpeed = 0;
|
||||
resp.valve = 0;
|
||||
}
|
||||
//MyHttp.SendHttpData(ttt.Item1.SysHotel.DeviceStatusPushURL, resp);
|
||||
XuanZhuOperation.ReportService(ttt.Item1.SysHotel.DeviceStatusPushURL, resp);
|
||||
|
||||
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
|
||||
@@ -1871,7 +1871,8 @@ namespace RCUHost.Implement
|
||||
else
|
||||
{
|
||||
string NoKey = CacheKey.HostModalStatus_BoolFilterPrefix + "_" + host.ID + "_" + device.Value.Address;
|
||||
CSRedisCacheHelper.Set_PartitionWithTime<int>(NoKey, 1, 10);
|
||||
var expiredata = new Random().Next(10, 50);
|
||||
CSRedisCacheHelper.Set_PartitionWithTime<int>(NoKey, 1, expiredata);
|
||||
//logger.Error("内存和数据库都不见这条数据:" + KKey);
|
||||
}
|
||||
#endregion
|
||||
@@ -2240,7 +2241,8 @@ namespace RCUHost.Implement
|
||||
faultType = fault.Value.Type,
|
||||
faultData = fault.Value.Data
|
||||
};
|
||||
XuanZhuOperation.ReportService(host.FaultPushURL, resp);
|
||||
//XuanZhuOperation.ReportService(host.FaultPushURL, resp);
|
||||
MyHttp.SendHttpData(host.FaultPushURL, resp);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user