天猫精灵背景音乐 ,官方文档 上的设置接口不管用,经过询问使用 另一个接口,完美解决

This commit is contained in:
2025-12-26 10:17:50 +08:00
parent b575adb844
commit 1ec13289dc
10 changed files with 165 additions and 85 deletions

View File

@@ -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");

View File

@@ -4346,10 +4346,20 @@ namespace WebSite.Controllers
string KKey = CacheKey.HostModalStatus_Prefix + "_" + host.ID.ToString() + "_" + device.Address;
var hostModal_T = CSRedisCacheHelper.Get_Partition<HostModal_Cache>(KKey);
bool JumpBrightcontrol = true;
var is_100 = devicesItem.value.HasValue;
if (is_100)
{
if (devicesItem.value == 100)
{
JumpBrightcontrol = false;
}
}
if (co == 1085 || co == 1001 || co == 1003 || co > 2000)
{
//logger.Error("查询的Key值:"+KKey);
if (hostModal_T != null && hostModal_T.Status == 2) { continue; }
if (hostModal_T != null && hostModal_T.Status == 2 && JumpBrightcontrol == true) { continue; }
}
if (devicesItem.value.HasValue)
{

View File

@@ -184,7 +184,7 @@ namespace WebSite.Controllers
Abnormal4Date = Convert.ToDateTime(r[15]).Year < 1900 ? "" : Convert.ToDateTime(r[15]).ToString("yyyy-MM-dd HH:mm:ss"),
Abnormal5 = Convert.ToDateTime(r[17]).Year < 1900 ? "" : r[16],
Abnormal5Date = Convert.ToDateTime(r[17]).Year < 1900 ? "" : Convert.ToDateTime(r[17]).ToString("yyyy-MM-dd HH:mm:ss")
}).Where(A=>!string.IsNullOrEmpty(A.Name));
}).Where(A => !string.IsNullOrEmpty(A.Name));
return Json(restult, JsonRequestBehavior.AllowGet);
}
@@ -408,10 +408,10 @@ namespace WebSite.Controllers
//string nenghaoKey = CacheKey.NengHao + "_" + mac;
string nenghaoKey = CacheKey.NengHao + "_" + host_number;
//var NNNHHH = CSRedisCacheHelper.ForeverGet<NengHao>(nenghaoKey);
var NNNHHH = CSRedisCacheHelper.Get_Partition<NengHao>(nenghaoKey,1);
var NNNHHH = CSRedisCacheHelper.Get_Partition<NengHao>(nenghaoKey, 1);
if (NNNHHH != null)
{
roomModel.Power = NNNHHH.P.ToString()+"w";
roomModel.Power = NNNHHH.P.ToString() + "w";
}
else
{
@@ -581,7 +581,18 @@ namespace WebSite.Controllers
//}
//②获取服务信息
//var services = HostModalManager.Load(room.HostID, DeviceType.ServiceInfo).Where(r => r.Modal.ActiveIndicator && r.Status == 1);
var services = HostModalManager.Load(room.HostID, DeviceType.ServiceInfo).Where(r => r.Modal.ActiveIndicator);
string KKServiceInfo = "ServiceInfo_" + room.HostID;
var oobsc = HttpContext.Cache.Get(KKServiceInfo);
IList<HostModal> services = null;
if (oobsc != null)
{
services = oobsc as IList<HostModal>;
}
else
{
services = HostModalManager.Load(room.HostID, DeviceType.ServiceInfo).Where(r => r.Modal.ActiveIndicator).ToList();
HttpContext.Cache.Insert(KKServiceInfo,services,null,DateTime.Now.AddMinutes(30),Cache.NoSlidingExpiration);
}
roomModel.Services = new List<ServiceModel>();
foreach (var service in services)
{
@@ -739,7 +750,7 @@ namespace WebSite.Controllers
if (string.IsNullOrEmpty(roomModel.Power))
{
roomModel.Power = "";
roomModel.Power = "";
}
floor.Sort = room.GroupSort;
rooms.Add(roomModel);