添加查询缓存
有一些效果,原来10分钟就会崩溃的,现在延长了一个小时,不过有的时候,还是会崩溃
This commit is contained in:
@@ -604,6 +604,7 @@ namespace WebSite.Controllers
|
||||
//return Json(new { IsSuccess = false, Result = "接口修改调整" }, JsonRequestBehavior.AllowGet);
|
||||
try
|
||||
{
|
||||
Interlocked.Increment(ref WebAPI_TongJi.GetRoomAirList);
|
||||
WebApiInvoke_FenXi("GetRoomAirList");
|
||||
string start_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
@@ -646,7 +647,7 @@ namespace WebSite.Controllers
|
||||
};
|
||||
list.Add(air);
|
||||
}
|
||||
HttpContext.Cache.Insert(KKK, list, null, DateTime.Now.AddMinutes(30), Cache.NoSlidingExpiration);
|
||||
HttpContext.Cache.Insert(KKK, list, null, DateTime.Now.AddHours(1), Cache.NoSlidingExpiration);
|
||||
}
|
||||
|
||||
string end_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
@@ -703,6 +704,7 @@ namespace WebSite.Controllers
|
||||
string start_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
try
|
||||
{
|
||||
Interlocked.Increment(ref WebAPI_TongJi.SetRCUAir);
|
||||
WebApiInvoke_FenXi("SetRCUAir");
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
string roomNumber = jData["roomNumber"].ToString();
|
||||
@@ -798,32 +800,45 @@ namespace WebSite.Controllers
|
||||
public ActionResult GetRoomSceneList(string jsonData)
|
||||
{
|
||||
|
||||
Interlocked.Increment(ref WebAPI_TongJi.GetRoomSceneList);
|
||||
string start_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
try
|
||||
{
|
||||
WebApiInvoke_FenXi("GetRoomSceneList");
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
string roomNumber = jData["roomNumber"].ToString();
|
||||
Host host = CheckRoomNumber(jData["code"].ToString(), jData["creatDate"].ToString(), ref msg, ref hotelID, roomNumber);
|
||||
if (host == null)
|
||||
{
|
||||
return Json(new { IsSuccess = false, Result = msg }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
IList<RoomTypeScene> modals = RoomTypeSceneManager.LoadAll().Where(r => r.RoomType.ID == host.RoomType.ID && r.ActiveIndicator).OrderBy(r => r.Sort).ToList();
|
||||
if (modals == null || modals.Count < 1)
|
||||
{
|
||||
return Json(new { IsSuccess = false, Result = "房号[" + roomNumber + "]未配置场景" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
string code = jData["code"].ToString();
|
||||
string cd = jData["creatDate"].ToString();
|
||||
List<SceneState> list = new List<SceneState>();
|
||||
foreach (var modal in modals)
|
||||
string KKK = "GetRoomSceneList_" + code + "_" + roomNumber + "_" + cd;
|
||||
var ooo = HttpContext.Cache.Get(KKK);
|
||||
if (ooo != null)
|
||||
{
|
||||
SceneState sceneState = new SceneState
|
||||
list = ooo as List<SceneState>;
|
||||
}
|
||||
else
|
||||
{
|
||||
Host host = CheckRoomNumber(code, cd, ref msg, ref hotelID, roomNumber);
|
||||
if (host == null)
|
||||
{
|
||||
SceneID = modal.ID,
|
||||
Name = modal.Name,
|
||||
Icon = modal.Icon
|
||||
};
|
||||
list.Add(sceneState);
|
||||
return Json(new { IsSuccess = false, Result = msg }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
IList<RoomTypeScene> modals = RoomTypeSceneManager.LoadAll().Where(r => r.RoomType.ID == host.RoomType.ID && r.ActiveIndicator).OrderBy(r => r.Sort).ToList();
|
||||
if (modals == null || modals.Count < 1)
|
||||
{
|
||||
return Json(new { IsSuccess = false, Result = "房号[" + roomNumber + "]未配置场景" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
foreach (var modal in modals)
|
||||
{
|
||||
SceneState sceneState = new SceneState
|
||||
{
|
||||
SceneID = modal.ID,
|
||||
Name = modal.Name,
|
||||
Icon = modal.Icon
|
||||
};
|
||||
list.Add(sceneState);
|
||||
}
|
||||
HttpContext.Cache.Insert(KKK, list, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 30, 0));
|
||||
}
|
||||
|
||||
string end_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
@@ -846,6 +861,7 @@ namespace WebSite.Controllers
|
||||
public ActionResult SetRCUScene(string jsonData)
|
||||
{
|
||||
|
||||
Interlocked.Increment(ref WebAPI_TongJi.SetRCUScene);
|
||||
string start_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
try
|
||||
{
|
||||
@@ -864,7 +880,18 @@ namespace WebSite.Controllers
|
||||
string sceneID = jData["sceneID"].ToString();//场景ID:1、2、3
|
||||
//string status = jData["status"].ToString();//状态:1开,2关
|
||||
|
||||
var scene = RoomTypeSceneManager.Get(int.Parse(sceneID));
|
||||
RoomTypeScene scene = null;
|
||||
string KKK = "SetSceneData_" + sceneID;
|
||||
var ooo = HttpContext.Cache.Get(KKK);
|
||||
if (ooo != null)
|
||||
{
|
||||
scene = ooo as RoomTypeScene;
|
||||
}
|
||||
else
|
||||
{
|
||||
scene = RoomTypeSceneManager.Get(int.Parse(sceneID));
|
||||
HttpContext.Cache.Insert(KKK, scene, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 30, 0));
|
||||
}
|
||||
if (scene == null)
|
||||
{
|
||||
return Json(new { IsSuccess = false, Result = "房号[" + roomNumber + "]无效的场景" }, JsonRequestBehavior.AllowGet);
|
||||
@@ -892,58 +919,72 @@ namespace WebSite.Controllers
|
||||
/// <returns></returns>
|
||||
public ActionResult GetRoomLightList(string jsonData)
|
||||
{
|
||||
|
||||
string start_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
//return Json(new { IsSuccess = false, Result = "接口修改调整" }, JsonRequestBehavior.AllowGet);
|
||||
try
|
||||
{
|
||||
Interlocked.Increment(ref WebAPI_TongJi.GetRoomLightList);
|
||||
WebApiInvoke_FenXi("GetRoomLightList");
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
string roomNumber = jData["roomNumber"].ToString();
|
||||
Host host = CheckRoomNumber(jData["code"].ToString(), jData["creatDate"].ToString(), ref msg, ref hotelID, roomNumber);
|
||||
string code = jData["code"].ToString();
|
||||
string cd = jData["creatDate"].ToString();
|
||||
Host host = CheckRoomNumber(code, cd, ref msg, ref hotelID, roomNumber);
|
||||
if (host == null)
|
||||
{
|
||||
return Json(new { IsSuccess = false, Result = msg }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
//IList<HostModal> hostModals = HostModalManager.LoadAll().Where(r => (r.Modal.Type == DeviceType.Relay || r.Modal.Type == DeviceType.Dimmer
|
||||
// || r.Modal.Type == DeviceType.PWMDimmer || r.Modal.Type == DeviceType.Traic || r.Modal.Type == DeviceType.PWMExpand || r.Modal.Type == DeviceType.PBLED)
|
||||
// && r.HostID == host.ID && r.Modal.ActiveIndicator == true).ToList();
|
||||
IList<HostModal> hostModals = HostModalManager.LoadByHostID(host.ID).Where(r => r.Modal.WXActiveIndicator).ToList();
|
||||
//if ((hostModals1 == null || hostModals1.Count < 1) && (hostModals2 == null || hostModals2.Count < 1))
|
||||
//{
|
||||
// return Json(new { IsSuccess = false, Result = "房号[" + roomNumber + "]未配置灯光或调光" }, JsonRequestBehavior.AllowGet);
|
||||
//}
|
||||
IList<Light> list = new List<Light>();
|
||||
foreach (HostModal modal in hostModals)
|
||||
|
||||
string KKK = "GetRoomLightList_" + code + "_" + roomNumber + "_" + cd;
|
||||
var QQQ = HttpContext.Cache.Get(KKK);
|
||||
if (QQQ != null)
|
||||
{
|
||||
switch (modal.Modal.Type)
|
||||
list = QQQ as IList<Light>;
|
||||
}
|
||||
else
|
||||
{
|
||||
//IList<HostModal> hostModals = HostModalManager.LoadAll().Where(r => (r.Modal.Type == DeviceType.Relay || r.Modal.Type == DeviceType.Dimmer
|
||||
// || r.Modal.Type == DeviceType.PWMDimmer || r.Modal.Type == DeviceType.Traic || r.Modal.Type == DeviceType.PWMExpand || r.Modal.Type == DeviceType.PBLED)
|
||||
// && r.HostID == host.ID && r.Modal.ActiveIndicator == true).ToList();
|
||||
IList<HostModal> hostModals = HostModalManager.LoadByHostID(host.ID).Where(r => r.Modal.WXActiveIndicator).ToList();
|
||||
//if ((hostModals1 == null || hostModals1.Count < 1) && (hostModals2 == null || hostModals2.Count < 1))
|
||||
//{
|
||||
// return Json(new { IsSuccess = false, Result = "房号[" + roomNumber + "]未配置灯光或调光" }, JsonRequestBehavior.AllowGet);
|
||||
//}
|
||||
foreach (HostModal modal in hostModals)
|
||||
{
|
||||
case DeviceType.Relay://主机继电器
|
||||
case DeviceType.Dimmer://LED调光
|
||||
case DeviceType.PWMDimmer://PWM调光
|
||||
case DeviceType.PWMExpand://PWM扩展
|
||||
case DeviceType.PBLED:
|
||||
case DeviceType.Traic://可控硅调光
|
||||
case DeviceType.Strip://灯带调光
|
||||
case DeviceType.A9IORelay:
|
||||
case DeviceType.LVout://弱电输出
|
||||
case DeviceType.Expand://扩展继电器
|
||||
case DeviceType.PB20:
|
||||
case DeviceType.PB20_LD:
|
||||
case DeviceType.PB20_LS:
|
||||
Light light = new Light
|
||||
{
|
||||
Name = ReturnNameByLanguage(modal.Modal.Name, modal.Modal.EnglishName, modal.Modal.TWName),
|
||||
ModalAddress = modal.Modal.ModalAddress,
|
||||
Status = modal.Status,
|
||||
Brightness = modal.Brightness
|
||||
};
|
||||
list.Add(light);
|
||||
break;
|
||||
switch (modal.Modal.Type)
|
||||
{
|
||||
case DeviceType.Relay://主机继电器
|
||||
case DeviceType.Dimmer://LED调光
|
||||
case DeviceType.PWMDimmer://PWM调光
|
||||
case DeviceType.PWMExpand://PWM扩展
|
||||
case DeviceType.PBLED:
|
||||
case DeviceType.Traic://可控硅调光
|
||||
case DeviceType.Strip://灯带调光
|
||||
case DeviceType.A9IORelay:
|
||||
case DeviceType.LVout://弱电输出
|
||||
case DeviceType.Expand://扩展继电器
|
||||
case DeviceType.PB20:
|
||||
case DeviceType.PB20_LD:
|
||||
case DeviceType.PB20_LS:
|
||||
Light light = new Light
|
||||
{
|
||||
Name = ReturnNameByLanguage(modal.Modal.Name, modal.Modal.EnglishName, modal.Modal.TWName),
|
||||
ModalAddress = modal.Modal.ModalAddress,
|
||||
Status = modal.Status,
|
||||
Brightness = modal.Brightness
|
||||
};
|
||||
list.Add(light);
|
||||
break;
|
||||
}
|
||||
}
|
||||
HttpContext.Cache.Insert(KKK, list, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 30, 0));
|
||||
}
|
||||
|
||||
string end_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
|
||||
TongJi(jsonData, start_time, end_time, jData, "GetRoomLightList");
|
||||
//SaveSystemLog(AuthorityID, HttpContext.InnerLanguage("LightControl"), "获取客房" + roomNumber + "灯光信息", true, "api", hotelID);
|
||||
return Json(new { IsSuccess = true, Result = list }, JsonRequestBehavior.AllowGet);
|
||||
@@ -964,6 +1005,7 @@ namespace WebSite.Controllers
|
||||
string start_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
try
|
||||
{
|
||||
Interlocked.Increment(ref WebAPI_TongJi.SetRCULight);
|
||||
WebApiInvoke_FenXi("SetRCULight");
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
string roomNumber = jData["roomNumber"].ToString();
|
||||
@@ -1014,29 +1056,42 @@ namespace WebSite.Controllers
|
||||
//return Json(new { IsSuccess = false, Result = "接口修改调整" }, JsonRequestBehavior.AllowGet);
|
||||
try
|
||||
{
|
||||
Interlocked.Increment(ref WebAPI_TongJi.GetRoomCurtainList);
|
||||
WebApiInvoke_FenXi("GetRCUStatus");
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
string roomNumber = jData["roomNumber"].ToString();
|
||||
Host host = CheckRoomNumber(jData["code"].ToString(), jData["creatDate"].ToString(), ref msg, ref hotelID, roomNumber);
|
||||
string code = jData["code"].ToString();
|
||||
string cd = jData["creatDate"].ToString();
|
||||
Host host = CheckRoomNumber(code, cd, ref msg, ref hotelID, roomNumber);
|
||||
if (host == null)
|
||||
{
|
||||
return Json(new { IsSuccess = false, Result = msg }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
IList<HostModal> hostModals = HostModalManager.Load(host.ID, DeviceType.Curtain).Where(r => r.Modal.WXActiveIndicator).ToList();
|
||||
if (hostModals == null || hostModals.Count < 1)
|
||||
{
|
||||
return Json(new { IsSuccess = false, Result = "房号[" + roomNumber + "]未配置窗帘" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
IList<Curtain> list = new List<Curtain>();
|
||||
foreach (HostModal modal in hostModals)
|
||||
string KKK = "GetRoomCurtainList_" + code + "_" + roomNumber + "_" + code;
|
||||
var data = HttpContext.Cache.Get(KKK);
|
||||
if (data != null)
|
||||
{
|
||||
Curtain curtain = new Curtain
|
||||
list = data as IList<Curtain>;
|
||||
}
|
||||
else
|
||||
{
|
||||
IList<HostModal> hostModals = HostModalManager.Load(host.ID, DeviceType.Curtain).Where(r => r.Modal.WXActiveIndicator).ToList();
|
||||
if (hostModals == null || hostModals.Count < 1)
|
||||
{
|
||||
Name = ReturnNameByLanguage(modal.Modal.Name, modal.Modal.EnglishName, modal.Modal.TWName),
|
||||
ModalAddress = modal.Modal.ModalAddress,
|
||||
Status = modal.Status
|
||||
};
|
||||
list.Add(curtain);
|
||||
return Json(new { IsSuccess = false, Result = "房号[" + roomNumber + "]未配置窗帘" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
foreach (HostModal modal in hostModals)
|
||||
{
|
||||
Curtain curtain = new Curtain
|
||||
{
|
||||
Name = ReturnNameByLanguage(modal.Modal.Name, modal.Modal.EnglishName, modal.Modal.TWName),
|
||||
ModalAddress = modal.Modal.ModalAddress,
|
||||
Status = modal.Status
|
||||
};
|
||||
list.Add(curtain);
|
||||
}
|
||||
HttpContext.Cache.Insert(KKK, list, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 30, 0));
|
||||
}
|
||||
|
||||
string end_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
@@ -1062,6 +1117,7 @@ namespace WebSite.Controllers
|
||||
string start_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
try
|
||||
{
|
||||
Interlocked.Increment(ref WebAPI_TongJi.SetRCUCurtain);
|
||||
WebApiInvoke_FenXi("SetRCUCurtain");
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
string roomNumber = jData["roomNumber"].ToString();
|
||||
@@ -1111,6 +1167,7 @@ namespace WebSite.Controllers
|
||||
string start_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
try
|
||||
{
|
||||
Interlocked.Increment(ref WebAPI_TongJi.GetRoomMusicList);
|
||||
WebApiInvoke_FenXi("GetRoomMusicList");
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
string roomNumber = jData["roomNumber"].ToString();
|
||||
@@ -1161,6 +1218,7 @@ namespace WebSite.Controllers
|
||||
string start_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
try
|
||||
{
|
||||
Interlocked.Increment(ref WebAPI_TongJi.SetRCUMusic);
|
||||
WebApiInvoke_FenXi("SetRCUMusic");
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
string roomNumber = jData["roomNumber"].ToString();
|
||||
@@ -1251,31 +1309,44 @@ namespace WebSite.Controllers
|
||||
string start_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
try
|
||||
{
|
||||
|
||||
Interlocked.Increment(ref WebAPI_TongJi.GetRoomServiceList);
|
||||
WebApiInvoke_FenXi("GetRoomServiceList");
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
string roomNumber = jData["roomNumber"].ToString();
|
||||
Host host = CheckRoomNumber(jData["code"].ToString(), jData["creatDate"].ToString(), ref msg, ref hotelID, roomNumber);
|
||||
string code = jData["code"].ToString();
|
||||
string cd = jData["creatDate"].ToString();
|
||||
Host host = CheckRoomNumber(code, cd, ref msg, ref hotelID, roomNumber);
|
||||
if (host == null)
|
||||
{
|
||||
return Json(new { IsSuccess = false, Result = msg }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
IList<HostModal> hostModals = HostModalManager.Load(host.ID, DeviceType.ServiceInfo).Where(r => r.Modal.WXActiveIndicator).ToList();
|
||||
if (hostModals == null || hostModals.Count < 1)
|
||||
{
|
||||
return Json(new { IsSuccess = false, Result = "房号[" + roomNumber + "]未配置服务信息" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
//logger.Error(string.Format("api获取酒店{0}客房{1}服务列表,来自{2}", jData["code"].ToString(), roomNumber, GetClientIP()));
|
||||
IList<Light> list = new List<Light>();
|
||||
foreach (HostModal modal in hostModals)
|
||||
|
||||
string KKK = "GetRoomServiceList_" + code + "_" + roomNumber + "_" + cd;
|
||||
var data = HttpContext.Cache.Get(KKK);
|
||||
if (data != null)
|
||||
{
|
||||
Light light = new Light
|
||||
list = data as IList<Light>;
|
||||
}
|
||||
else
|
||||
{
|
||||
IList<HostModal> hostModals = HostModalManager.Load(host.ID, DeviceType.ServiceInfo).Where(r => r.Modal.WXActiveIndicator).ToList();
|
||||
if (hostModals == null || hostModals.Count < 1)
|
||||
{
|
||||
Name = ReturnNameByLanguage(modal.Modal.Name, modal.Modal.EnglishName, modal.Modal.TWName),
|
||||
ModalAddress = modal.Modal.ModalAddress,
|
||||
Status = modal.Status
|
||||
};
|
||||
list.Add(light);
|
||||
return Json(new { IsSuccess = false, Result = "房号[" + roomNumber + "]未配置服务信息" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
//logger.Error(string.Format("api获取酒店{0}客房{1}服务列表,来自{2}", jData["code"].ToString(), roomNumber, GetClientIP()));
|
||||
foreach (HostModal modal in hostModals)
|
||||
{
|
||||
Light light = new Light
|
||||
{
|
||||
Name = ReturnNameByLanguage(modal.Modal.Name, modal.Modal.EnglishName, modal.Modal.TWName),
|
||||
ModalAddress = modal.Modal.ModalAddress,
|
||||
Status = modal.Status
|
||||
};
|
||||
list.Add(light);
|
||||
}
|
||||
HttpContext.Cache.Insert(KKK, list, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 30, 0));
|
||||
}
|
||||
|
||||
string end_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
@@ -1299,6 +1370,7 @@ namespace WebSite.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
Interlocked.Increment(ref WebAPI_TongJi.SetRCUService);
|
||||
WebApiInvoke_FenXi("SetRCUService");
|
||||
string start_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
@@ -1389,7 +1461,7 @@ namespace WebSite.Controllers
|
||||
string start_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
try
|
||||
{
|
||||
|
||||
Interlocked.Increment(ref WebAPI_TongJi.GetOperationLog);
|
||||
WebApiInvoke_FenXi("GetOperationLog");
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
Host host = CheckRoomNumber(jData["code"].ToString(), jData["creatDate"].ToString(), ref msg, ref hotelID, "");
|
||||
@@ -1444,26 +1516,39 @@ namespace WebSite.Controllers
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Interlocked.Increment(ref WebAPI_TongJi.GetAirDetectList);
|
||||
WebApiInvoke_FenXi("GetAirDetectList");
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
string roomNumber = jData["roomNumber"].ToString();
|
||||
Host host = CheckRoomNumber(jData["code"].ToString(), jData["creatDate"].ToString(), ref msg, ref hotelID, roomNumber);
|
||||
if (host == null)
|
||||
{
|
||||
return Json(new { IsSuccess = false, Result = msg }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
string code = jData["code"].ToString();
|
||||
string cd = jData["creatDate"].ToString();
|
||||
IList<Light> list = new List<Light>();
|
||||
var hostModals = HostModalManager.Load(host.ID, DeviceType.AirDetect).Where(r => r.Modal.WXActiveIndicator);
|
||||
foreach (HostModal modal in hostModals)
|
||||
|
||||
string KKK = "GetAirDetectList_" + code + "_" + roomNumber + "_" + cd;
|
||||
var ooo = HttpContext.Cache.Get(KKK);
|
||||
if (ooo != null)
|
||||
{
|
||||
Light light = new Light
|
||||
list = ooo as IList<Light>;
|
||||
}
|
||||
else
|
||||
{
|
||||
Host host = CheckRoomNumber(code, cd, ref msg, ref hotelID, roomNumber);
|
||||
if (host == null)
|
||||
{
|
||||
Name = ReturnNameByLanguage(modal.Modal.Name, modal.Modal.EnglishName, modal.Modal.TWName),
|
||||
ModalAddress = modal.Modal.ModalAddress,
|
||||
Brightness = modal.Brightness
|
||||
};
|
||||
list.Add(light);
|
||||
return Json(new { IsSuccess = false, Result = msg }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
var hostModals = HostModalManager.Load(host.ID, DeviceType.AirDetect).Where(r => r.Modal.WXActiveIndicator);
|
||||
foreach (HostModal modal in hostModals)
|
||||
{
|
||||
Light light = new Light
|
||||
{
|
||||
Name = ReturnNameByLanguage(modal.Modal.Name, modal.Modal.EnglishName, modal.Modal.TWName),
|
||||
ModalAddress = modal.Modal.ModalAddress,
|
||||
Brightness = modal.Brightness
|
||||
};
|
||||
list.Add(light);
|
||||
}
|
||||
HttpContext.Cache.Insert(KKK, list, null, Cache.NoAbsoluteExpiration, new TimeSpan(0, 30, 0));
|
||||
}
|
||||
|
||||
string end_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
@@ -1494,7 +1579,7 @@ namespace WebSite.Controllers
|
||||
string start_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
try
|
||||
{
|
||||
|
||||
Interlocked.Increment(ref WebAPI_TongJi.GetHostFaultList);
|
||||
WebApiInvoke_FenXi("GetHostFaultList");
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
string roomNumber = jData["roomNumber"].ToString();
|
||||
@@ -1623,7 +1708,7 @@ namespace WebSite.Controllers
|
||||
string start_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
try
|
||||
{
|
||||
|
||||
Interlocked.Increment(ref WebAPI_TongJi.GetRoomTypeAndModalsList);
|
||||
WebApiInvoke_FenXi("GetRoomTypeAndModalsList");
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
Host host1 = CheckRoomNumber(jData["code"].ToString(), jData["creatDate"].ToString(), ref msg, ref hotelID, "");
|
||||
@@ -2465,6 +2550,7 @@ namespace WebSite.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
Interlocked.Increment(ref WebAPI_TongJi.GetSessionKey);
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
string code = jData["code"].ToString();
|
||||
string appid = jData["appid"].ToString();
|
||||
@@ -2501,6 +2587,7 @@ namespace WebSite.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
Interlocked.Increment(ref WebAPI_TongJi.GetPhoneNumber);
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
string encryptedData = jData["encrypted_data"].ToString();
|
||||
string iv = jData["iv"].ToString();
|
||||
@@ -2539,6 +2626,7 @@ namespace WebSite.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
Interlocked.Increment(ref WebAPI_TongJi.GetHotelInfoForWX);
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
string phone = jData["phone"].ToString();
|
||||
if (string.IsNullOrEmpty(phone))
|
||||
@@ -3210,6 +3298,7 @@ namespace WebSite.Controllers
|
||||
{
|
||||
try
|
||||
{
|
||||
Interlocked.Increment(ref WebAPI_TongJi.GetRCUInfoForPDU);
|
||||
JObject jData = (JObject)JsonConvert.DeserializeObject(jsonData);
|
||||
Host host1 = CheckRoomNumber(jData["code"].ToString(), jData["creatDate"].ToString(), ref msg, ref hotelID, "");
|
||||
if (host1 == null && hotelID == 0)
|
||||
@@ -5284,6 +5373,76 @@ namespace WebSite.Controllers
|
||||
string mns3 = Newtonsoft.Json.JsonConvert.SerializeObject(ux2);
|
||||
CSRedisCacheHelper.redis3.Publish("redis-udppackage", mns3);
|
||||
|
||||
|
||||
long l1 = Interlocked.Read(ref WebAPI_TongJi.GetRoomAirList);
|
||||
long l2 = Interlocked.Read(ref WebAPI_TongJi.SetRCUAir);
|
||||
long l3 = Interlocked.Read(ref WebAPI_TongJi.GetRoomSceneList);
|
||||
long l4 = Interlocked.Read(ref WebAPI_TongJi.SetRCUScene);
|
||||
long l5 = Interlocked.Read(ref WebAPI_TongJi.GetRoomLightList);
|
||||
long l6 = Interlocked.Read(ref WebAPI_TongJi.SetRCULight);
|
||||
long l7 = Interlocked.Read(ref WebAPI_TongJi.GetRoomCurtainList);
|
||||
long l8 = Interlocked.Read(ref WebAPI_TongJi.SetRCUCurtain);
|
||||
long l9 = Interlocked.Read(ref WebAPI_TongJi.GetRoomServiceList);
|
||||
long l10 = Interlocked.Read(ref WebAPI_TongJi.SetRCUService);
|
||||
long l11 = Interlocked.Read(ref WebAPI_TongJi.GetOperationLog);
|
||||
long l12 = Interlocked.Read(ref WebAPI_TongJi.GetRoomMusicList);
|
||||
long l13 = Interlocked.Read(ref WebAPI_TongJi.SetRCUMusic);
|
||||
long l14 = Interlocked.Read(ref WebAPI_TongJi.GetRCUStatus);
|
||||
long l15 = Interlocked.Read(ref WebAPI_TongJi.GetAirDetectList);
|
||||
long l16 = Interlocked.Read(ref WebAPI_TongJi.GetHostFaultList);
|
||||
long l17 = Interlocked.Read(ref WebAPI_TongJi.GetRoomTypeAndModalsList);
|
||||
long l18 = Interlocked.Read(ref WebAPI_TongJi.GetRCUInfoForPDU);
|
||||
long l19 = Interlocked.Read(ref WebAPI_TongJi.GetSessionKey);
|
||||
long l20 = Interlocked.Read(ref WebAPI_TongJi.GetPhoneNumber);
|
||||
long l21 = Interlocked.Read(ref WebAPI_TongJi.GetHotelInfoForWX);
|
||||
|
||||
Dictionary<string, long> dicwebapidata = new Dictionary<string, long>();
|
||||
dicwebapidata.Add("GetRoomAirList", l1);
|
||||
dicwebapidata.Add("SetRCUAir", l2);
|
||||
dicwebapidata.Add("GetRoomSceneList", l3);
|
||||
dicwebapidata.Add("SetRCUScene", l4);
|
||||
dicwebapidata.Add("GetRoomLightList", l5);
|
||||
dicwebapidata.Add("SetRCULight", l6);
|
||||
dicwebapidata.Add("GetRoomCurtainList", l7);
|
||||
dicwebapidata.Add("SetRCUCurtain", l8);
|
||||
dicwebapidata.Add("GetRoomServiceList", l9);
|
||||
dicwebapidata.Add("SetRCUService", l10);
|
||||
dicwebapidata.Add("GetOperationLog", l11);
|
||||
dicwebapidata.Add("GetRoomMusicList", l12);
|
||||
dicwebapidata.Add("SetRCUMusic", l13);
|
||||
dicwebapidata.Add("GetRCUStatus", l14);
|
||||
dicwebapidata.Add("GetAirDetectList", l15);
|
||||
dicwebapidata.Add("GetHostFaultList", l16);
|
||||
dicwebapidata.Add("GetRoomTypeAndModalsList", l17);
|
||||
dicwebapidata.Add("GetRCUInfoForPDU", l18);
|
||||
dicwebapidata.Add("GetSessionKey", l19);
|
||||
dicwebapidata.Add("GetPhoneNumber", l20);
|
||||
dicwebapidata.Add("GetHotelInfoForWX", l21);
|
||||
|
||||
CSRedisCacheHelper.Publish("webapidata_consumer", JsonConvert.SerializeObject(dicwebapidata));
|
||||
|
||||
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRoomAirList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.SetRCUAir, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRoomSceneList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.SetRCUScene, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRoomLightList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.SetRCULight, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRoomCurtainList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.SetRCUCurtain, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRoomServiceList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.SetRCUService, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetOperationLog, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRoomMusicList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.SetRCUMusic, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRCUStatus, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetAirDetectList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetHostFaultList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRoomTypeAndModalsList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRCUInfoForPDU, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetSessionKey, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetPhoneNumber, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetHotelInfoForWX, 0);
|
||||
//logger.Error("推送的走到这里了");
|
||||
//DataTongJi.TotalCount.Clear();
|
||||
Interlocked.Exchange(ref YUANZI_TongJi.TotalReceiveCount, 0);
|
||||
@@ -5540,6 +5699,75 @@ namespace WebSite.Controllers
|
||||
string mns3 = Newtonsoft.Json.JsonConvert.SerializeObject(ux2);
|
||||
CSRedisCacheHelper.redis3.Publish("redis-udppackage", mns3);
|
||||
|
||||
long l1 = Interlocked.Read(ref WebAPI_TongJi.GetRoomAirList);
|
||||
long l2 = Interlocked.Read(ref WebAPI_TongJi.SetRCUAir);
|
||||
long l3 = Interlocked.Read(ref WebAPI_TongJi.GetRoomSceneList);
|
||||
long l4 = Interlocked.Read(ref WebAPI_TongJi.SetRCUScene);
|
||||
long l5 = Interlocked.Read(ref WebAPI_TongJi.GetRoomLightList);
|
||||
long l6 = Interlocked.Read(ref WebAPI_TongJi.SetRCULight);
|
||||
long l7 = Interlocked.Read(ref WebAPI_TongJi.GetRoomCurtainList);
|
||||
long l8 = Interlocked.Read(ref WebAPI_TongJi.SetRCUCurtain);
|
||||
long l9 = Interlocked.Read(ref WebAPI_TongJi.GetRoomServiceList);
|
||||
long l10 = Interlocked.Read(ref WebAPI_TongJi.SetRCUService);
|
||||
long l11 = Interlocked.Read(ref WebAPI_TongJi.GetOperationLog);
|
||||
long l12 = Interlocked.Read(ref WebAPI_TongJi.GetRoomMusicList);
|
||||
long l13 = Interlocked.Read(ref WebAPI_TongJi.SetRCUMusic);
|
||||
long l14 = Interlocked.Read(ref WebAPI_TongJi.GetRCUStatus);
|
||||
long l15 = Interlocked.Read(ref WebAPI_TongJi.GetAirDetectList);
|
||||
long l16 = Interlocked.Read(ref WebAPI_TongJi.GetHostFaultList);
|
||||
long l17 = Interlocked.Read(ref WebAPI_TongJi.GetRoomTypeAndModalsList);
|
||||
long l18 = Interlocked.Read(ref WebAPI_TongJi.GetRCUInfoForPDU);
|
||||
long l19 = Interlocked.Read(ref WebAPI_TongJi.GetSessionKey);
|
||||
long l20 = Interlocked.Read(ref WebAPI_TongJi.GetPhoneNumber);
|
||||
long l21 = Interlocked.Read(ref WebAPI_TongJi.GetHotelInfoForWX);
|
||||
|
||||
Dictionary<string, long> dicwebapidata = new Dictionary<string, long>();
|
||||
dicwebapidata.Add("GetRoomAirList", l1);
|
||||
dicwebapidata.Add("SetRCUAir", l2);
|
||||
dicwebapidata.Add("GetRoomSceneList", l3);
|
||||
dicwebapidata.Add("SetRCUScene", l4);
|
||||
dicwebapidata.Add("GetRoomLightList", l5);
|
||||
dicwebapidata.Add("SetRCULight", l6);
|
||||
dicwebapidata.Add("GetRoomCurtainList", l7);
|
||||
dicwebapidata.Add("SetRCUCurtain", l8);
|
||||
dicwebapidata.Add("GetRoomServiceList", l9);
|
||||
dicwebapidata.Add("SetRCUService", l10);
|
||||
dicwebapidata.Add("GetOperationLog", l11);
|
||||
dicwebapidata.Add("GetRoomMusicList", l12);
|
||||
dicwebapidata.Add("SetRCUMusic", l13);
|
||||
dicwebapidata.Add("GetRCUStatus", l14);
|
||||
dicwebapidata.Add("GetAirDetectList", l15);
|
||||
dicwebapidata.Add("GetHostFaultList", l16);
|
||||
dicwebapidata.Add("GetRoomTypeAndModalsList", l17);
|
||||
dicwebapidata.Add("GetRCUInfoForPDU", l18);
|
||||
dicwebapidata.Add("GetSessionKey", l19);
|
||||
dicwebapidata.Add("GetPhoneNumber", l20);
|
||||
dicwebapidata.Add("GetHotelInfoForWX", l21);
|
||||
|
||||
CSRedisCacheHelper.Publish("webapidata_consumer", JsonConvert.SerializeObject(dicwebapidata));
|
||||
|
||||
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRoomAirList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.SetRCUAir, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRoomSceneList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.SetRCUScene, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRoomLightList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.SetRCULight, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRoomCurtainList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.SetRCUCurtain, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRoomServiceList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.SetRCUService, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetOperationLog, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRoomMusicList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.SetRCUMusic, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRCUStatus, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetAirDetectList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetHostFaultList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRoomTypeAndModalsList, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetRCUInfoForPDU, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetSessionKey, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetPhoneNumber, 0);
|
||||
Interlocked.Exchange(ref WebAPI_TongJi.GetHotelInfoForWX, 0);
|
||||
//logger.Error("推送的走到这里了");
|
||||
//DataTongJi.TotalCount.Clear();
|
||||
Interlocked.Exchange(ref YUANZI_TongJi.TotalReceiveCount, 0);
|
||||
@@ -5742,8 +5970,17 @@ namespace WebSite.Controllers
|
||||
[HttpPost()]
|
||||
public ActionResult GetRCUStatus(string host_number, string mac)
|
||||
{
|
||||
bool is_online = CSRedisCacheHelper.Contains(host_number, mac);
|
||||
return Json(is_online, JsonRequestBehavior.AllowGet);
|
||||
|
||||
Interlocked.Increment(ref WebAPI_TongJi.GetRCUStatus);
|
||||
try
|
||||
{
|
||||
bool is_online = CSRedisCacheHelper.Contains(host_number, mac);
|
||||
return Json(is_online, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return Json(false, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user