From 1ec6794e808b9627276255ca3846326c9316034a Mon Sep 17 00:00:00 2001
From: gxc <gxc@hdlchina.com.cn>
Date: 星期三, 11 十二月 2019 16:36:53 +0800
Subject: [PATCH] 2019.12.11-2

---
 ZigbeeApp/Shared/Phone/Device/Account/AccountLogic.cs |   85 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 85 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Account/AccountLogic.cs b/ZigbeeApp/Shared/Phone/Device/Account/AccountLogic.cs
index 534233a..8ced26e 100644
--- a/ZigbeeApp/Shared/Phone/Device/Account/AccountLogic.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Account/AccountLogic.cs
@@ -1,4 +1,5 @@
 锘縰sing System;
+using System.Text;
 using System.Text.RegularExpressions;
 using Shared.Common;
 
@@ -97,5 +98,89 @@
         }
 
         #endregion
+
+        #region 鈼� 缁忕含搴_________________________
+        /// <summary>
+        /// ReceiveAppLatAndLon
+        /// </summary>
+        /// <param name="lat"></param>
+        /// <param name="lon"></param>
+        public async void ReceiveAppLatAndLon(string lat, string lon)
+        {
+            try
+            {
+                var requestObj = new SendDataToServer.ReceiveAppLatAndLonObj
+                {
+                    Latitude = lat,
+                    Longitude = lon
+                };
+                var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
+                var revertObj = await RequestHttpsZigbeeAsync("ProcessRange/ReceiveAppLatAndLon", System.Text.Encoding.UTF8.GetBytes(requestJson));
+                //if (revertObj.StateCode.ToUpper() == "SUCCESS")
+                //{
+                //    System.Console.WriteLine("涓婁紶浣嶇疆鎴愬姛" + lat + lon);
+                //}
+            }
+            catch { }
+        }
+
+        /// <summary>
+        /// 璇锋眰鏈嶅姟鍣ㄦ柟娉�
+        /// 鎸囧畾涓�涓猆rl,鍜岃姹傛柟娉曪紝鏁版嵁锛孋ookie锛屽緱鍒板搷搴旂殑鏁版嵁
+        /// </summary>
+        /// <param name="requestUrl">璇锋眰Url</param>
+        /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param>
+        /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns>
+        public async System.Threading.Tasks.Task<Shared.Common.ResponseEntity.ResponsePack> RequestHttpsZigbeeAsync(string requestUrl, byte[] byteData)
+        {
+            string result = await RequestHttpsZigbeeResultAsync(requestUrl, byteData);
+            if (result != null)
+            {
+                try
+                {
+                    var data = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.ResponsePack>(result);
+                    return data;
+                }
+                catch (Exception ex)
+                {
+                    System.Console.WriteLine(ex.Message);
+                }
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// 璇锋眰鏈嶅姟鍣ㄦ柟娉�
+        /// 鎸囧畾涓�涓猆rl,鍜岃姹傛柟娉曪紝鏁版嵁锛孋ookie锛屽緱鍒板搷搴旂殑鏁版嵁
+        /// </summary>
+        /// <param name="requestUrl">璇锋眰Url</param>
+        /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param>
+        /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns>
+        public async System.Threading.Tasks.Task<string> RequestHttpsZigbeeResultAsync(string requestUrl, byte[] byteData)
+        {
+            var result = await RequestHttpsZigbeeBytesResultAsync(requestUrl, byteData);
+            if (result != null)
+            {
+                return Encoding.UTF8.GetString(result);
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// 璇锋眰鏈嶅姟鍣ㄦ柟娉�
+        /// 鎸囧畾涓�涓猆rl,鍜岃姹傛柟娉曪紝鏁版嵁锛孋ookie锛屽緱鍒板搷搴旂殑鏁版嵁
+        /// </summary>
+        /// <param name="requestUrl">璇锋眰Url</param>
+        /// <param name="byteData">璇锋眰鐨勭殑鏁版嵁</param>
+        /// <param name="requestMethod">POST 鎴栬�� GET 绛夌瓑</param>
+        /// <returns>寰楀埌鍝嶅簲鐨勬暟鎹�</returns>
+        public async System.Threading.Tasks.Task<byte[]> RequestHttpsZigbeeBytesResultAsync(string requestUrl, byte[] byteData, string requestMethod = "POST")
+        {
+            //璇锋眰Url鐨勫畬鎴愯矾寰�
+            var fullUrl = $"{CommonPage.RequestHttpsHost}/{requestUrl}";
+            return await CommonPage.Instance.DoRequestZigbeeHttpsInterface(fullUrl, byteData, Config.Instance.LoginToken, requestMethod);
+        }
+
+        #endregion
     }
 }

--
Gitblit v1.8.0