From 270b3d8539f6b4a991a9ebf3b3a9eceb436d61d5 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期四, 28 十月 2021 17:08:02 +0800
Subject: [PATCH] 自动化地址问题修复

---
 HDL_ON/DAL/Server/HttpServerRequest.cs |   57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 55 insertions(+), 2 deletions(-)

diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index aec2776..1fbd42c 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -1307,9 +1307,9 @@
 
 #region 鑾峰彇澶╂皵閮ㄥ垎
         /// <summary>
-        /// 鑾峰彇鎸囧畾缁忕含搴︾殑鍩庡競淇℃伅
+        /// 鑾峰彇鎸囧畾缁忕含搴︾殑鍩庡競淇℃伅澶╂皵淇℃伅
         /// </summary>
-        public void GetCityInfo(string lon, string lat)
+        public void GetCityWeatherInfo(string lon, string lat)
         {
             System.Threading.Tasks.Task.Run(() =>
             {
@@ -1372,6 +1372,59 @@
                 });
             });
         }
+        ///// <summary>
+        ///// 鑾峰彇鎸囧畾缁忕含搴︾殑鍩庡競淇℃伅
+        ///// </summary>
+        ///// <param name="lon"></param>
+        ///// <param name="lat"></param>
+        //public void GetCityInfo()
+        //{
+        //    if (DB_ResidenceData.Instance.CurrentRegion.longitude == 0 && DB_ResidenceData.Instance.CurrentRegion.latitude == 0)
+        //    {
+        //        return;
+        //    }
+        //    string lon = DB_ResidenceData.Instance.CurrentRegion.longitude.ToString();
+        //    string lat = DB_ResidenceData.Instance.CurrentRegion.latitude.ToString();
+        //    System.Threading.Tasks.Task.Run(() =>
+        //    {
+        //        while (true)
+        //        {
+        //            var webClient = new WebClient();
+        //            string url = $"https://developer.hdlcontrol.com/Weather/Weather/FindCity/?lon={lon}&lat={lat}";
+        //            string responseString = null;
+        //            try
+        //            {
+        //                responseString = Encoding.UTF8.GetString(webClient.DownloadData(url));
+        //            }
+        //            catch (Exception ex)
+        //            {
+        //                MainPage.Log(ex.Message);
+        //            }
+
+        //            if (responseString != null)
+        //            {
+        //                try
+        //                {
+        //                    var revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePack>(responseString);
+        //                    JObject jt = Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(revertObj.ResponseData.ToString());
+
+        //                    DB_ResidenceData.cityInfo.location = jt.GetValue("Location").ToString();
+        //                    DB_ResidenceData.cityInfo.province = jt.GetValue("Province").ToString();
+        //                    DB_ResidenceData.cityInfo.country = jt.GetValue("Country").ToString();
+        //                    DB_ResidenceData.cityInfo.timeZone = jt.GetValue("TimeZone").ToString();
+        //                    DB_ResidenceData.Instance.SaveResidenceData();
+
+        //                    return;
+        //                }
+        //                catch (Exception ex)
+        //                {
+        //                    MainPage.Log($"get weather error : {ex.Message}");
+        //                }
+        //            }
+        //        }
+        //    });
+        //}
+
 
 #endregion
 

--
Gitblit v1.8.0