From ae95e3f4b9cbc1e7be2773068e28e2ac911c48c4 Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期一, 28 十月 2024 10:39:15 +0800 Subject: [PATCH] 默认服务器 --- HDL_ON/UI/UI1-Login/RegisterPageBLL.cs | 54 ++++++++++++++++++++++++++---------------------------- 1 files changed, 26 insertions(+), 28 deletions(-) diff --git a/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs b/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs index 3cb73e7..9f32abc 100644 --- a/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs +++ b/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs @@ -778,33 +778,29 @@ waitPage.Start(Language.StringByID(StringId.PleaseWait)); - System.Threading.Tasks.Task.Run(async () => - { + System.Threading.Tasks.Task.Run(() => { try { - string country = "CN"; - - try - { - using (HttpClient client = new HttpClient()) - { - // 浣跨敤 ipinfo.io 鑾峰彇浣嶇疆淇℃伅 - HttpResponseMessage response = await client.GetAsync("https://ipinfo.io/json"); - - if (response.IsSuccessStatusCode) - { - string json = await response.Content.ReadAsStringAsync(); - JObject jsonObject = JObject.Parse(json); - - // 浠庤繑鍥炵殑 JSON 涓彁鍙栧浗瀹朵俊鎭� - country = jsonObject["country"].ToString(); - } - } - } - catch (Exception ex) - { - MainPage.Log("Error",$"Error fetching IP info: {ex.StackTrace}"); - } + //string country = "CN"; + //try + //{ + // using (HttpClient client = new HttpClient()) + // { + // // 浣跨敤 ipinfo.io 鑾峰彇浣嶇疆淇℃伅 + // HttpResponseMessage response = await client.GetAsync("https://ipinfo.io/json"); + // if (response.IsSuccessStatusCode) + // { + // string json = await response.Content.ReadAsStringAsync(); + // JObject jsonObject = JObject.Parse(json); + // // 浠庤繑鍥炵殑 JSON 涓彁鍙栧浗瀹朵俊鎭� + // country = jsonObject["country"].ToString(); + // } + // } + //} + //catch (Exception ex) + //{ + // MainPage.Log("Error",$"Error fetching IP info: {ex.StackTrace}"); + //} serverList = new List<GlobalRegionListRes>(); var requestJson = HttpUtil.GetSignRequestJson(new GetRegionListObj() { regionMark = HttpUtil.RegionMark }); @@ -819,12 +815,13 @@ serverList = responseDataObj; if (serverList.Count > 0) { - if (country == "CN")//if (Language.CurrentLanguage == "Chinese") + if (Language.CurrentLanguage == "Chinese")//if (country == "CN")// { var server = serverList.Find((obj) => obj.regionUrl.Contains("china-gateway")); if (server != null) { OnAppConfig.Instance.GlobalRegion = server; + OnAppConfig.Instance.RequestHttpsHost = server.regionUrl; SetServerText(); } } @@ -834,6 +831,7 @@ if (server != null) { OnAppConfig.Instance.GlobalRegion = server; + OnAppConfig.Instance.RequestHttpsHost = server.regionUrl; SetServerText(); } } @@ -847,9 +845,9 @@ IMessageCommon.Current.ShowErrorInfoAlter(revertObj.Code); } } - catch + catch (Exception ex) { - + MainPage.Log("Error", $"鑾峰彇鏈嶅姟鍣ㄥ紓甯革細{ex.StackTrace}"); } finally { -- Gitblit v1.8.0