From 6a9ad7ec93218913a2ce3b898bb036f18f8f0da4 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期四, 13 八月 2020 17:06:36 +0800 Subject: [PATCH] 20200813 --- HDL_ON/DAL/Server/HttpServerRequest.cs | 105 +++++++++++++++++++++++++++++++--------------------- 1 files changed, 62 insertions(+), 43 deletions(-) diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs index feab9f3..c297ae7 100644 --- a/HDL_ON/DAL/Server/HttpServerRequest.cs +++ b/HDL_ON/DAL/Server/HttpServerRequest.cs @@ -45,6 +45,35 @@ #endif } + /// <summary> + /// 鑾峰彇浼犳劅鍣ㄥ巻鍙叉暟鎹� + /// </summary> + /// <param name="subnetId"></param> + /// <param name="deviceId"></param> + /// <param name="bigClass"></param> + /// <param name="minClass"></param> + /// <param name="queryType"></param> + /// <param name="loopId"></param> + /// <param name="nowMonth"></param> + /// <param name="mac"></param> + /// <returns></returns> + public ResponsePack GetSensorHistory(int subnetId,int deviceId,int bigClass,int minClass,int queryType,int loopId,int nowMonth,string mac) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("SubnetID", subnetId); + d.Add("DeviceID", deviceId); + d.Add("LargeType", bigClass); + d.Add("SmallType", minClass); + d.Add("QueryType", queryType); + d.Add("loopId", loopId); + d.Add("NowMonth", nowMonth); + d.Add("MAC", DB_ResidenceData.residenceData.residenceGatewayMAC); + d.Add("LocalTimeZone", 8); + var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d); + return RequestHttps("https://developer.hdlcontrol.com/api/GetSensorPushHistory", jsonString,true); + + } + public string GetRequestResultMsg(string resultCode) { string result = ""; @@ -68,7 +97,6 @@ } return result; } - #region 娉ㄥ唽銆佺櫥褰曢儴鍒� @@ -150,7 +178,7 @@ /// <summary> /// 鑾峰彇娉ㄥ唽楠岃瘉鐮� /// </summary> - public ResponsePack GetPhoneRegisterVerCode(string account) + public ResponsePack GetRegisterVerCode(string account) { string jsonString = "{" + "\"Account\":" + "\"" + account + "\"" + "," + @@ -168,12 +196,11 @@ /// <summary> /// 鑾峰彇鐧诲綍楠岃瘉鐮� /// </summary> - /// <param name="phoneNum">鎵嬫満鍙风爜</param> - public ResponsePack GetPhoneLoginVerCode(string phoneNum) + public ResponsePack GetLoginVerCode(string account) { string jsonString = "{" + - "\"Account\":" + "\"" + phoneNum + "\"" + "," + + "\"Account\":" + "\"" + account + "\"" + "," + "\"AreaCode\":" + "86" + "}"; return RequestHttps($"{severAddress}/ZigbeeUsers/LoginSendVerCode", jsonString, false); @@ -247,21 +274,17 @@ try { var headImageString = dataStr.GetValue("HeadImage").ToString(); - var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(headImageString); - var headImageBytes = Newtonsoft.Json.JsonConvert.DeserializeObject<byte[]>(jsonString); - MainPage.LoginUser.headImagePageBytes = headImageBytes; - var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/", "headImage.png"); - -#if DEBUG - Application.RunOnMainThread(() => + if (!string.IsNullOrEmpty(headImageString)) { - new Tip() { CloseTime = 5, Text = filePath }.Show(MainPage.BasePageView); - }); -#endif - fs = new FileStream(filePath, FileMode.Create, FileAccess.Write); - fs.Write(headImageBytes, 0, headImageBytes.Length); - fs.Flush(); - MainPage.LoginUser.headImagePagePath = filePath; + var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(headImageString); + var headImageBytes = Newtonsoft.Json.JsonConvert.DeserializeObject<byte[]>(jsonString); + MainPage.LoginUser.headImagePageBytes = headImageBytes; + var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/", "headImage.png"); + fs = new FileStream(filePath, FileMode.Create, FileAccess.Write); + fs.Write(headImageBytes, 0, headImageBytes.Length); + fs.Flush(); + MainPage.LoginUser.headImagePagePath = filePath; + } } catch (Exception ex) { MainPage.Log($"download headImage error : {ex.Message}"); @@ -319,6 +342,18 @@ var revertObj = RequestHttps($"{severAddress}/ZigbeeUsers/UpdateHeadImage", requestJson, true); return revertObj.StateCode; + } + + /// <summary> + /// 鏇存敼缁戝畾璐︽埛鐨勯偖绠辨垨鑰呮墜鏈哄彿 + /// </summary> + /// <param name="account"></param> + /// <returns></returns> + public string BindAccount(string account) + { + string jsonString = "{" + "\"Account\":" + "\"" + account + "\"" + "}"; + var responsePack = RequestHttps($"{severAddress}/ZigbeeUsers/BindAccount", jsonString, true); + return responsePack.StateCode; } #endregion @@ -653,7 +688,6 @@ #endregion - #region 澶囦唤閮ㄥ垎 /// <summary> /// 鑾峰彇浣忓畢澶囦唤鍒楄〃 @@ -885,23 +919,8 @@ /// <summary> /// 鍔熻兘ID - /// 鍘傚晢浠g爜 2bytes; 01 HDL - /// 閫氳鏂瑰紡 1byte ; 01 HDL Bus; 02 Zigbee;03 KNX;04 Z-Wave - /// 浜у搧GUID 8bytes - /// 浜у搧绫诲埆 1byte ; 01 璋冨厜鍣�;02缁х數鍣�;03骞叉帴鐐规ā鍧�;04浼犳劅鍣�;05闈㈡澘 - /// 鐗╂ā鍨嬬被鍨�2bytes 01 寮�鍏崇被 --01寮�鍏�;02鎻掑骇 - /// 02 鐓ф槑 --01寮�鍏崇被;02璋冨厜绫�;03鑹叉俯;04LED - /// 03 閬槼 --01绐楀笜鐢垫満;02鐧惧彾绐�;03寮�鍚堝笜;04鍗峰笜 - /// 04 鎭掓俯鍣� --01绌鸿皟;02鍦版殩;03姣涚粏绌鸿皟 - /// 05 鏂伴 - /// 06 褰遍煶 - /// 07 闊充箰 - /// 08 鑳芥簮 - /// 09 瀹夐槻 - /// 閫氶亾鍙� 2bytes - /// Key_id 2bytes /// </summary> - /// "00010112345678901234560101230123AABB"; + /// "03010112345678901234560101230123AABB"; var buffer = Guid.NewGuid().ToByteArray(); string guid = ""; if (buffer != null) @@ -939,7 +958,7 @@ } DB_ResidenceData.residenceData.functionList.lights.Add(new Light() { - sid = "000101" + guid + "0102010001AABB", + sid = "030101" + guid + "0102010001AABB", name = ss.GetValue("Name").ToString(), function = new List<Trait>() { new Trait { attri="on_off", max=100,min = 0, value= new List<string> { "on","off"} }, @@ -965,7 +984,7 @@ } DB_ResidenceData.residenceData.functionList.lights.Add(new Light() { - sid = "000101" + guid + "0202020001AABB", + sid = "030101" + guid + "0202020001AABB", name = ss.GetValue("Name").ToString(), function = new List<Trait>() { new Trait { attri="brightness", max=100,min = 0, value= new List<string> { "up","down"} }, @@ -992,7 +1011,7 @@ } DB_ResidenceData.residenceData.functionList.lights.Add(new Light() { - sid = "000101" + guid + "0202040001AABB", + sid = "030101" + guid + "0202040001AABB", name = ss.GetValue("Name").ToString(), function = new List<Trait>() { new Trait { attri="brightness", max=100,min = 0, value= new List<string> { "on","off"} }, @@ -1021,7 +1040,7 @@ } DB_ResidenceData.residenceData.functionList.aCs.Add(new AC() { - sid = "000101" + guid + "0204010001AABB", + sid = "030101" + guid + "0204010001AABB", name = ss.GetValue("Name").ToString(), function = new List<Trait>() { new Trait { attri="on_off", max=1,min = 0, value= new List<string> { "on","off"} }, @@ -1051,7 +1070,7 @@ } DB_ResidenceData.residenceData.functionList.curtains.Add(new Curtain() { - sid = "000101" + guid + "0203010001AABB", + sid = "030101" + guid + "0203010001AABB", name = ss.GetValue("Name").ToString(), roomIdList = roomIds, //roomIdList = new List<string>() { roomSid }, @@ -1077,7 +1096,7 @@ } DB_ResidenceData.residenceData.functionList.curtains.Add(new Curtain() { - sid = "000101" + guid + "0203040001AABB", + sid = "030101" + guid + "0203040001AABB", name = ss.GetValue("Name").ToString(), roomIdList = roomIds, //roomIdList = new List<string>() { roomSid }, @@ -1103,7 +1122,7 @@ } DB_ResidenceData.residenceData.functionList.curtains.Add(new Curtain() { - sid = "000101" + guid + "0203030001AABB", + sid = "030101" + guid + "0203030001AABB", name = ss.GetValue("Name").ToString(), roomIdList = roomIds, //roomIdList = new List<string>() { roomSid }, -- Gitblit v1.8.0