From 2a900e186e9ddf97facd33082df063183c7483b8 Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期五, 27 九月 2024 09:51:56 +0800 Subject: [PATCH] 阿里云日志,注册 --- HDL_ON/UI/UI1-Login/RegisterPageBLL.cs | 52 ++++++++--------- HDL_ON/Common/AliyunLog/AliyunLogClient.cs | 3 HDL_ON/UI/UI1-Login/RegisterPage.cs | 118 --------------------------------------- 3 files changed, 26 insertions(+), 147 deletions(-) diff --git a/HDL_ON/Common/AliyunLog/AliyunLogClient.cs b/HDL_ON/Common/AliyunLog/AliyunLogClient.cs index c73b943..a63450f 100644 --- a/HDL_ON/Common/AliyunLog/AliyunLogClient.cs +++ b/HDL_ON/Common/AliyunLog/AliyunLogClient.cs @@ -118,7 +118,6 @@ LogTags = new Dictionary<string, string> { {"tag1", DateTime.Now.ToLongTimeString()}, - }, Logs = new List<LogInfo> { @@ -127,7 +126,7 @@ Time = DateTimeOffset.Now, Contents = new Dictionary<string, string> { - {"id", DateTime.Now.Ticks.ToString()}, + {"version", MainPage.VersionString}, {"userAccount", UserInfo.Current.AccountString}, {"userid", UserInfo.Current.ID}, {"userName", UserInfo.Current.userName}, diff --git a/HDL_ON/UI/UI1-Login/RegisterPage.cs b/HDL_ON/UI/UI1-Login/RegisterPage.cs index 73b0979..69c1291 100644 --- a/HDL_ON/UI/UI1-Login/RegisterPage.cs +++ b/HDL_ON/UI/UI1-Login/RegisterPage.cs @@ -274,7 +274,6 @@ }; new TopViewDiv(this, bodyView, Language.StringByID(StringId.Register)) { maginY = 10 }.LoadTopView(backAction); - //new PublicAssmebly().LoadTopView(this, bodyView, Language.StringByID(StringId.Register)); #region 娉ㄥ唽鏂瑰紡閫夋嫨 btnPhoneLogin = new Button() @@ -760,10 +759,7 @@ Thread.Sleep(1500); Application.RunOnMainThread(() => { - ////鍒涘缓鐧诲綍绾跨▼ - //var loginThread = LoadThread_Login(account, password); - //waitPage = new Loading(); - //new PublicAssmebly().LoadPage_WaitPage(loginThread, bodyView, waitPage); + //鍒涘缓鐧诲綍绾跨▼ dialog.Close(); var isPhone = registerType == 0; @@ -773,117 +769,5 @@ { IsBackground = true }.Start(); } - //#region 鐧诲綍绾跨▼閮ㄥ垎 - ///// <summary> - ///// 鍔犺浇鐧诲綍绾跨▼ - ///// </summary> - //Thread LoadThread_Login(string account,string password) - //{ - // var loginThread = new Thread(() => - // { - // try - // { - // //鐧诲綍 - // var loginResult = LoadMethod_Login(account,password); - // if (loginResult) - // { - // //鑾峰彇浣忓畢淇℃伅 - // var getResidencesResult = LoadMethod_GetResidences(); - // if (getResidencesResult) - // { - // /* - // * Wait : 鎺ㄩ�佹敞鍐� - // */ - - // Application.RunOnMainThread(() => - // { - // waitPage.RemoveFromParent(); - // waitPage = null; - - // //璺宠浆椤甸潰---- - // MainPage.GoUserPage(); - // }); - // } - // } - // } - // catch (Exception ex) - // { - // MainPage.Log($"LoginPage : {ex.Message}"); - // } - // }) - // { IsBackground = true }; - // return loginThread; - //} - - ///// <summary> - ///// 璋冪敤鐧诲綍鎺ュ彛鐧诲綍 - ///// </summary> - //bool LoadMethod_Login(string account, string password) - //{ - // var result = false; - // //璋冪敤鐧诲綍鎺ュ彛 - // var loginResult = pm.LoginByPassword(account, password); - // if (loginResult.Code == StateCode.SUCCESS) - // { - // var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(loginResult.Data.ToString()); - // // UserInfo.Current = new UserInfo - // //{ - // // userType = revertData.userType, - // // accountString = account, - // // password = password, - // // lastTime = DateTime.Now, - // // ID = revertData.userId, - // // loginTokenString = revertData.headerPrefix + revertData.accessToken, - // // refreshToken = revertData.refreshToken, - // // userName = revertData.name - // //}; - // UserInfo.Current.userType = revertData.userType; - // UserInfo.Current.AccountString = account; - // //UserInfo.Current.password = password; - // UserInfo.Current.LastTime = DateTime.Now; - // UserInfo.Current.ID = revertData.userId; - // UserInfo.Current.LoginTokenString = revertData.headerPrefix + revertData.accessToken; - // UserInfo.Current.RefreshToken = revertData.refreshToken; - // UserInfo.Current.userName = revertData.name; - - // UserInfo.Current.SaveUserInfo(); - // MainPage.Log("鐧诲綍鎴愬姛銆�"); - // result = true; - // } - // else - // { - // //鐧诲綍澶辫触 - // IMessageCommon.Current.ShowErrorInfoAlter(loginResult.Code); - // Application.RunOnMainThread(() => - // { - // btnPasswordViewBottomLine.BackgroundColor = CSS_Color.AuxiliaryColor2; - // btnPasswordViewBottomLine.Height = Application.GetRealHeight(2); - // }); - // } - // return result; - //} - - ///// <summary> - ///// 鑾峰彇浣忓畢鍒楄〃 - ///// </summary> - //bool LoadMethod_GetResidences() - //{ - // var result = false; - // var responsePack = pm.GetHomePager(); - // if (responsePack == StateCode.SUCCESS) - // { - // //2020-11-13 寰呯‘璁わ紝娌℃湁浣忓畢锛屼笉绠楃櫥褰曟垚鍔� - // if (UserInfo.Current.regionList != null && UserInfo.Current.regionList.Count > 0) - // { - // result = true; - // } - // } - // else - // { - // IMessageCommon.Current.ShowErrorInfoAlter(responsePack); - // } - // return result; - //} - //#endregion } } \ No newline at end of file diff --git a/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs b/HDL_ON/UI/UI1-Login/RegisterPageBLL.cs index 3cb73e7..d055779 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,7 +815,7 @@ 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) @@ -847,9 +843,9 @@ IMessageCommon.Current.ShowErrorInfoAlter(revertObj.Code); } } - catch + catch (Exception ex) { - + MainPage.Log("Error", $"鑾峰彇鏈嶅姟鍣ㄥ紓甯革細{ex.StackTrace}"); } finally { -- Gitblit v1.8.0