修改一些BUG
修改碳达人问题,增加小数,增加门锁的支持
This commit is contained in:
Binary file not shown.
@@ -73,6 +73,7 @@
|
||||
<Compile Include="KongQi.cs" />
|
||||
<Compile Include="LieECOTaskExtra.cs" />
|
||||
<Compile Include="LingChenECO.cs" />
|
||||
<Compile Include="LMRegisterInfo.cs" />
|
||||
<Compile Include="LogRecorrd.cs" />
|
||||
<Compile Include="LostData.cs" />
|
||||
<Compile Include="MissionRequestData.cs" />
|
||||
|
||||
26
CommonEntity/LMRegisterInfo.cs
Normal file
26
CommonEntity/LMRegisterInfo.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace CommonEntity
|
||||
{
|
||||
public class LMRegisterInfo
|
||||
{
|
||||
// 基础信息
|
||||
public string HotelCode { get; set; }
|
||||
public string RoomNumber { get; set; }
|
||||
public string HostNumber { get; set; }
|
||||
public string MAC { get; set; }
|
||||
|
||||
// 网络信息
|
||||
public string EndPoint { get; set; }
|
||||
public byte[] Original_Data { get; set; }
|
||||
public string CurrentDateTime { get; set; }
|
||||
public long UnixTime { get; set; }
|
||||
//public string ConfigVersion { get; set; }
|
||||
//public string SubnetMask { get; set; }
|
||||
//public string Gateway { get; set; }
|
||||
//public string DNS { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,17 @@ namespace CommonEntity
|
||||
public long deadline { get; set; }
|
||||
public string refresh_token { get; set; }
|
||||
}
|
||||
public class TCLBell
|
||||
{
|
||||
public string cuid { get; set; }
|
||||
public string sceneCode { get; set; }
|
||||
public string botId { get; set; }
|
||||
public PPP @params { get; set; }
|
||||
}
|
||||
public class PPP
|
||||
{
|
||||
public string url { get; set; }
|
||||
}
|
||||
|
||||
public class TCLCommon
|
||||
{
|
||||
@@ -59,7 +70,7 @@ namespace CommonEntity
|
||||
/// <param name="skillid"></param>
|
||||
/// <param name="sceneCode"></param>
|
||||
/// <param name="count"></param>
|
||||
public static void SendData(string hotelcode, string roomnum, string CUID, string skillid, string sceneCode, int count = 0,Dictionary<string,string> extra_params=null)
|
||||
public static void SendData(string hotelcode, string roomnum, string CUID, string skillid, string sceneCode, int count = 0, Dictionary<string, string> extra_params = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -77,7 +88,7 @@ namespace CommonEntity
|
||||
dic1.Add("cuid", roomnum);
|
||||
dic1.Add("sceneCode", sceneCode);
|
||||
dic1.Add("botId", skillid);
|
||||
dic1.Add("params",Newtonsoft.Json.JsonConvert.SerializeObject(extra_params));
|
||||
dic1.Add("params", Newtonsoft.Json.JsonConvert.SerializeObject(extra_params));
|
||||
|
||||
|
||||
logger.Error("TCL send data");
|
||||
@@ -108,12 +119,22 @@ namespace CommonEntity
|
||||
|
||||
request1.AddHeader("Authorization", "Bearer " + T.data.access_token);
|
||||
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
dic.Add("cuid", CUID);
|
||||
dic.Add("sceneCode", sceneCode);
|
||||
dic.Add("botId", skillid);
|
||||
//Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
//dic.Add("cuid", CUID);
|
||||
//dic.Add("sceneCode", sceneCode);
|
||||
//dic.Add("botId", skillid);
|
||||
//dic.Add("params", Newtonsoft.Json.JsonConvert.SerializeObject(extra_params));
|
||||
|
||||
request1.AddJsonBody(dic);
|
||||
TCLBell tsa = new TCLBell();
|
||||
tsa.cuid = CUID;
|
||||
tsa.sceneCode = sceneCode;
|
||||
tsa.botId = skillid;
|
||||
if (extra_params != null && extra_params.Count > 0)
|
||||
{
|
||||
tsa.@params = new PPP() { url = extra_params["url"] };
|
||||
}
|
||||
|
||||
request1.AddJsonBody(tsa);
|
||||
var QQQ = client1.Execute(request1);
|
||||
string ddd = QQQ.Content;
|
||||
|
||||
|
||||
@@ -85,10 +85,10 @@ namespace RCUHost.Implement
|
||||
|
||||
int startIndex = StructConverter.SizeOf(context.SystemHeader);
|
||||
SearchHostPacketReply? reply = DecodeSearchHostPacketReply(context.Data, startIndex);
|
||||
SearchHostPacketReplyV2? reply2 = null;
|
||||
SearchHostPacketReplyV2? C_Xilie_zhuji = null;
|
||||
if (context.Data.Length > 100)//V2版本新补充的内容
|
||||
{
|
||||
reply2 = DecodeSearchHostPacketReplyV2(context.Data, 58);
|
||||
C_Xilie_zhuji = DecodeSearchHostPacketReplyV2(context.Data, 58);
|
||||
}
|
||||
if (reply.HasValue)
|
||||
{
|
||||
@@ -103,7 +103,7 @@ namespace RCUHost.Implement
|
||||
Host exitEntity = null;
|
||||
StringBuilder sbSQL = new StringBuilder();
|
||||
sbSQL.Append("UPDATE tb_Hosts SET ");
|
||||
if (reply2.HasValue)//C系列主机处理:只能靠后台手工添加
|
||||
if (C_Xilie_zhuji.HasValue)//C系列主机处理:只能靠后台手工添加
|
||||
{
|
||||
#region C系列主要
|
||||
if (string.IsNullOrEmpty(context.SystemHeader.Value.HostNumber.ToString()))
|
||||
@@ -140,7 +140,7 @@ namespace RCUHost.Implement
|
||||
MemoryCacheHelper.Set(KKK1, EEE);
|
||||
MemoryCacheHelper.SlideSet(KKK2, EEE);
|
||||
}
|
||||
exitEntity.DNS = string.Join(".", reply2.Value.DNS);
|
||||
exitEntity.DNS = string.Join(".", C_Xilie_zhuji.Value.DNS);
|
||||
sbSQL.Append("DNS='" + exitEntity.DNS + "'");
|
||||
if (!version.ToUpper().StartsWith("C"))
|
||||
{
|
||||
|
||||
@@ -1231,6 +1231,15 @@ namespace RCUHost.Implement
|
||||
}, TS);
|
||||
}
|
||||
|
||||
public static SearchHostPacketReply? DecodeSearchHostPacketReply(byte[] data, int startIndex)
|
||||
{
|
||||
return StructConverter.BytesToStruct(data, startIndex, typeof(SearchHostPacketReply)) as SearchHostPacketReply?;
|
||||
}
|
||||
|
||||
public static SearchHostPacketReplyV2? DecodeSearchHostPacketReplyV2(byte[] data, int startIndex)
|
||||
{
|
||||
return StructConverter.BytesToStruct(data, startIndex, typeof(SearchHostPacketReplyV2)) as SearchHostPacketReplyV2?;
|
||||
}
|
||||
//private static readonly RecyclableMemoryStreamManager manager = new RecyclableMemoryStreamManager();
|
||||
/// <summary>
|
||||
/// 处理数据
|
||||
@@ -1335,6 +1344,45 @@ namespace RCUHost.Implement
|
||||
}
|
||||
#endregion
|
||||
|
||||
///注册指令 也要推送
|
||||
if (cmdType == 0x01)
|
||||
{
|
||||
string RoomNUMBER = CSRedisCacheHelper.HMGet<string>(5, CacheKey.RoomNumber_HostNumber, HostNNN)[0];
|
||||
if (string.IsNullOrEmpty(RoomNUMBER))
|
||||
{
|
||||
return;
|
||||
}
|
||||
int startIndex = StructConverter.SizeOf(context111.SystemHeader);
|
||||
SearchHostPacketReply? reply = DecodeSearchHostPacketReply(context111.Data, startIndex);
|
||||
//SearchHostPacketReplyV2? C_Xilie_zhuji = null;
|
||||
//if (context111.Data.Length > 100)//V2版本新补充的内容
|
||||
//{
|
||||
// C_Xilie_zhuji = DecodeSearchHostPacketReplyV2(context111.Data, 58);
|
||||
//}
|
||||
string MAC = "";
|
||||
if (reply.HasValue)
|
||||
{
|
||||
MAC = BitConverter.ToString(reply.Value.MAC);
|
||||
//string version = reply.Value.Version;
|
||||
//var ConfigVersion = String.Join(".", reply.Value.ConfigVersion);
|
||||
//var SubnetMask = String.Join(".", reply.Value.SubnetMask);
|
||||
//var Gateway = String.Join(".", reply.Value.Gateway);
|
||||
}
|
||||
|
||||
LMRegisterInfo lma = new LMRegisterInfo();
|
||||
lma.HotelCode = CODE;
|
||||
lma.RoomNumber = RoomNUMBER;
|
||||
lma.HostNumber = HostNNN;
|
||||
lma.MAC = MAC;
|
||||
lma.Original_Data = context111.Data;
|
||||
|
||||
string ti = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
lma.CurrentDateTime = ti;
|
||||
lma.UnixTime = Tools.GetUnixTime();
|
||||
|
||||
string sss = Newtonsoft.Json.JsonConvert.SerializeObject(lma);
|
||||
CSRedisCacheHelper.Publish("redis-0X01", sss);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -2286,7 +2334,7 @@ namespace RCUHost.Implement
|
||||
var CarbonVIP = reader.ReadByte();
|
||||
|
||||
int Bright_Va = -1;
|
||||
if (Version == 0x03)
|
||||
if (Version == 0x03 || Version == 0x04)
|
||||
{
|
||||
var LiangDu = reader.ReadBytes(4);
|
||||
Bright_Va = (int)LiangDu[0];
|
||||
@@ -2298,6 +2346,40 @@ namespace RCUHost.Implement
|
||||
{
|
||||
CarbonVIP = 0x00;
|
||||
}
|
||||
|
||||
///碳达人状态更新
|
||||
if (!string.IsNullOrEmpty(HostID))
|
||||
{
|
||||
string KKey = CacheKey.HostModalStatus_Prefix + "_" + HostID + "_" + "054000001";
|
||||
//var OldHostModal = CSRedisCacheHelper.Get_Partition<HostModal_Cache>(KKey);
|
||||
//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);
|
||||
}
|
||||
|
||||
var DeviceCount = reader.ReadByte();
|
||||
int DeviceCount_I = (int)DeviceCount;
|
||||
|
||||
@@ -2307,7 +2389,11 @@ namespace RCUHost.Implement
|
||||
List<KongTiao> kongtiaoList = new List<KongTiao>();
|
||||
for (int i = 0; i < DeviceCount_I; i++)
|
||||
{
|
||||
var QA = reader.ReadBytes(4);
|
||||
byte[] QA = reader.ReadBytes(4);
|
||||
//if (Version == 0x04)
|
||||
//{
|
||||
// QA = reader.ReadBytes(5);
|
||||
//}
|
||||
//说明是能耗设备
|
||||
#region 能耗
|
||||
if (QA[0] == 0x39)
|
||||
@@ -2413,6 +2499,14 @@ namespace RCUHost.Implement
|
||||
|
||||
///ushort StatusReceiver = reader.ReadUInt16();
|
||||
ushort StatusReceiver = BitConverter.ToUInt16(reader.ReadBytes(2).Reverse().ToArray(), 0);
|
||||
int XiaoShu_BuFen = 0;
|
||||
float xiaoshu_l = 0.0f;
|
||||
if (Version == 0x04)
|
||||
{
|
||||
var XiaoShu = reader.ReadByte();
|
||||
XiaoShu_BuFen = XiaoShu;
|
||||
xiaoshu_l = XiaoShu_BuFen / 10;
|
||||
}
|
||||
|
||||
if (true)
|
||||
{
|
||||
@@ -2436,7 +2530,7 @@ namespace RCUHost.Implement
|
||||
kkk.address = address;
|
||||
kkk.model = mode;
|
||||
kkk.speed = fanspeed;
|
||||
kkk.now_temp = currentTemp;
|
||||
kkk.now_temp = Convert.ToInt32((currentTemp + xiaoshu_l) * 10);
|
||||
kkk.set_temp = temperature;
|
||||
kkk.solenoid_valve = valve;
|
||||
kongtiaoList.Add(kkk);
|
||||
@@ -2556,8 +2650,9 @@ namespace RCUHost.Implement
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error("定是上报出错:" + ex.Message);
|
||||
logger.Error("定是上报出错:" + ex.StackTrace);
|
||||
logger.Error("定时上报出错:" + Tools.ByteToString(context111.Data));
|
||||
logger.Error("定时上报出错:" + ex.Message);
|
||||
logger.Error("定时上报出错:" + ex.StackTrace);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -583,7 +583,6 @@ namespace RCUHost.Implement
|
||||
if (!string.IsNullOrEmpty(ebell_rtsp))
|
||||
{
|
||||
ddd.Add("url",ebell_rtsp);
|
||||
ddd.Add("display_duration",du.ToString());
|
||||
}
|
||||
|
||||
TCLCommon.SendData(hotelcode, roomnum, TCLcuid, skillid, "DOORBELL",0,ddd);
|
||||
|
||||
@@ -475,15 +475,22 @@ namespace WebSite.Controllers
|
||||
actions.Add("setVolumeMute");
|
||||
break;
|
||||
default:
|
||||
if ((hostModal.Modal.Name != null && hostModal.Modal.Name.IndexOf("灯") > -1) ||
|
||||
(hostModal.Modal.EnglishName != null && hostModal.Modal.EnglishName.ToLower().IndexOf("light") > -1) ||
|
||||
(hostModal.Modal.TWName != null && hostModal.Modal.TWName.IndexOf("燈") > -1))
|
||||
if (hostModal.Modal.ModalAddress.Equals("004000010"))
|
||||
{
|
||||
applianceTypes.Add("LIGHT");
|
||||
applianceTypes.Add("DOOR_LOCK");
|
||||
}
|
||||
else
|
||||
{
|
||||
applianceTypes.Add("SWITCH");
|
||||
if ((hostModal.Modal.Name != null && hostModal.Modal.Name.IndexOf("灯") > -1) ||
|
||||
(hostModal.Modal.EnglishName != null && hostModal.Modal.EnglishName.ToLower().IndexOf("light") > -1) ||
|
||||
(hostModal.Modal.TWName != null && hostModal.Modal.TWName.IndexOf("燈") > -1))
|
||||
{
|
||||
applianceTypes.Add("LIGHT");
|
||||
}
|
||||
else
|
||||
{
|
||||
applianceTypes.Add("SWITCH");
|
||||
}
|
||||
}
|
||||
actions.Add("turnOn");
|
||||
actions.Add("turnOff");
|
||||
|
||||
Reference in New Issue
Block a user