From e53a1951d6aa07ad22aad9816da4703496fcbccd Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期五, 27 十一月 2020 14:27:16 +0800 Subject: [PATCH] 1127最新合并代码,合并嘉乐更新 --- HDL_ON/DAL/Server/IMessageCommon.cs | 93 ++++++++++++++++++++++++++++++++++++---------- 1 files changed, 72 insertions(+), 21 deletions(-) diff --git a/HDL_ON/DAL/Server/IMessageCommon.cs b/HDL_ON/DAL/Server/IMessageCommon.cs index cc5f79c..5b9e64d 100644 --- a/HDL_ON/DAL/Server/IMessageCommon.cs +++ b/HDL_ON/DAL/Server/IMessageCommon.cs @@ -9,7 +9,7 @@ /// </summary> public class IMessageCommon { - + /// <summary> /// 鎺ュ彛绫荤殑杩斿洖淇℃伅 /// </summary> @@ -30,6 +30,12 @@ return m_Current; } } + + /// <summary> + /// 鏄惁鍦ㄨ幏鍙杢oken + /// </summary> + public bool isGetingToken; + /// <summary> /// 鏃犺閿欒(璁块棶浜戠鏃讹紝姝ゆ搷浣滃皢涓嶄細寮瑰嚭閿欒) /// </summary> @@ -69,7 +75,7 @@ //楠岃瘉鐮佸彂閫侀绻侊紝璇风◢鍚庡啀璇曪紒 stateCodeDic["15"] = HDL_ON.StringId.VerificationCodeSentFrequently; //浼氳瘽瓒呮椂锛岃鏇存柊token - stateCodeDic["10001"] = HDL_ON.StringId.NotLogin; + stateCodeDic[StateCode.TOKEN_EXPIRED] = HDL_ON.StringId.NotLogin; ////鐧诲綍澶辫触锛岃处鍙锋垨鑰呭瘑鐮侀敊璇� stateCodeDic["10008"] = HDL_ON.StringId.LoginFailed_AccountOrPasswordError; //璐﹀彿涓嶅瓨鍦� @@ -231,32 +237,72 @@ { try { - string mes = GetMsgByRequestName(statuCode); - if (mes == null) return; - if (!string.IsNullOrEmpty(tipStr)) + //濡傛灉鏄痶oken杩囨湡鍒欏埛鏂皌oken + if (statuCode == StateCode.TOKEN_EXPIRED) { - mes = tipStr + "\n" + mes; - } - if (isTipStyle) - { - Application.RunOnMainThread(() => { - var tip = new Tip() - { - Text = mes, - CloseTime = closeTime, - Direction = AMPopTipDirection.None - }; - tip.Show(MainPage.BaseView); - }); + StartRefreshToken(); } else { - Application.RunOnMainThread(() => { - new Alert("", mes, Language.StringByID(HDL_ON.StringId.Close)).Show(); - }); + string mes = GetMsgByRequestName(statuCode); + if (mes == null) return; + if (!string.IsNullOrEmpty(tipStr)) + { + mes = tipStr + "\n" + mes; + } + if (isTipStyle) + { + Application.RunOnMainThread(() => + { + var tip = new Tip() + { + Text = mes, + CloseTime = closeTime, + Direction = AMPopTipDirection.None + }; + tip.Show(MainPage.BaseView); + }); + } + else + { + Application.RunOnMainThread(() => + { + new Alert("", mes, Language.StringByID(HDL_ON.StringId.Close)).Show(); + }); + } } } catch { } + } + + /// <summary> + /// StartRefreshToken + /// </summary> + public void StartRefreshToken() + { + if (isGetingToken) return; + + new System.Threading.Thread(() => + { + isGetingToken = true; + + try + { + var success = new HttpServerRequest().RefreshToken(); + if (success) { + Utlis.WriteLine("RefreshToken success"); + } + } + catch + { + } + finally + { + isGetingToken = false; + } + }) + { IsBackground = true }.Start(); + } } @@ -270,9 +316,14 @@ /// </summary> public const string SUCCESS = "0"; /// <summary> + /// 浼氳瘽瓒呮椂锛岃鏇存柊token + /// </summary> + public const string TOKEN_EXPIRED = "10001"; + /// <summary> /// 璐﹀彿涓嶅瓨鍦ㄧ殑閿欒鐮� /// </summary> public const string ACCOUNT_NOT_EXIST = "10010"; + } } -- Gitblit v1.8.0