天猫精灵背景音乐 ,官方文档 上的设置接口不管用,经过询问使用 另一个接口,完美解决
This commit is contained in:
@@ -608,33 +608,45 @@ namespace WebSite.Controllers
|
||||
string start_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
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<HostModal> hostModals = HostModalManager.Load(host.ID, DeviceType.AirConditioner).Where(r => r.Modal.WXActiveIndicator).ToList();
|
||||
if (hostModals == null || hostModals.Count < 1)
|
||||
{
|
||||
return Json(new { IsSuccess = false, Result = "房号[" + roomNumber + "]未配置空调" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
string code = jData["code"].ToString();
|
||||
string cd = jData["creatDate"].ToString();
|
||||
string KKK = "GetRoomAirList_" + roomNumber + "_" + code + "_" + cd;
|
||||
List<Air> list = new List<Air>();
|
||||
foreach (HostModal item in hostModals)
|
||||
var dbdata = HttpContext.Cache.Get(KKK);
|
||||
if (dbdata != null)
|
||||
{
|
||||
Air air = new Air
|
||||
list = dbdata as List<Air>;
|
||||
}
|
||||
else
|
||||
{
|
||||
Host host = CheckRoomNumber(code, cd, ref msg, ref hotelID, roomNumber);
|
||||
if (host == null)
|
||||
{
|
||||
HostID = item.HostID,
|
||||
ModalAddress = item.Modal.ModalAddress,
|
||||
Name = item.Modal.Name,
|
||||
RoomTypeAirID = item.Modal.ID,
|
||||
Status = item.Status,
|
||||
SettingTemp = item.SettingTemp,
|
||||
CurrentTemp = item.CurrentTemp,
|
||||
Mode = item.Mode,
|
||||
FanSpeed = item.FanSpeed,
|
||||
Valve = item.Valve
|
||||
};
|
||||
list.Add(air);
|
||||
return Json(new { IsSuccess = false, Result = msg }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
IList<HostModal> hostModals = HostModalManager.Load(host.ID, DeviceType.AirConditioner).Where(r => r.Modal.WXActiveIndicator).ToList();
|
||||
if (hostModals == null || hostModals.Count < 1)
|
||||
{
|
||||
return Json(new { IsSuccess = false, Result = "房号[" + roomNumber + "]未配置空调" }, JsonRequestBehavior.AllowGet);
|
||||
}
|
||||
foreach (HostModal item in hostModals)
|
||||
{
|
||||
Air air = new Air
|
||||
{
|
||||
HostID = item.HostID,
|
||||
ModalAddress = item.Modal.ModalAddress,
|
||||
Name = item.Modal.Name,
|
||||
RoomTypeAirID = item.Modal.ID,
|
||||
Status = item.Status,
|
||||
SettingTemp = item.SettingTemp,
|
||||
CurrentTemp = item.CurrentTemp,
|
||||
Mode = item.Mode,
|
||||
FanSpeed = item.FanSpeed,
|
||||
Valve = item.Valve
|
||||
};
|
||||
list.Add(air);
|
||||
}
|
||||
HttpContext.Cache.Insert(KKK, list, null, DateTime.Now.AddMinutes(30), Cache.NoSlidingExpiration);
|
||||
}
|
||||
|
||||
string end_time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");
|
||||
|
||||
Reference in New Issue
Block a user