From efad979b6fae76fb37a4de7e94e6bac0a85cb72c Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期二, 30 十一月 2021 13:14:28 +0800 Subject: [PATCH] 2021-11-30 1.修复乐橙Android,没调用拒接接口问题。 --- HDL_ON/DAL/Server/IMessageCommon.cs | 288 ++++++++++++++++++++++++++++++++------------------------- 1 files changed, 162 insertions(+), 126 deletions(-) diff --git a/HDL_ON/DAL/Server/IMessageCommon.cs b/HDL_ON/DAL/Server/IMessageCommon.cs index eae567b..2564a72 100644 --- a/HDL_ON/DAL/Server/IMessageCommon.cs +++ b/HDL_ON/DAL/Server/IMessageCommon.cs @@ -61,134 +61,144 @@ #region 鍏遍�氶敊璇爜 stateCodeDic = new Dictionary<string, int>(); //涓庢湇鍔″櫒閫氳澶辫触 - stateCodeDic["NETWORK_ERROR"] = HDL_ON.StringId.FailedRequestServer; + stateCodeDic["NETWORK_ERROR"] = StringId.FailedRequestServer; //鏁版嵁寮傚父 - stateCodeDic["DATA_EXCEPTION"] = HDL_ON.StringId.DataExceptionPleaseTryAgain; - - #region 鍩虹鏈嶅姟 鏂伴敊璇爜 + stateCodeDic["DATA_EXCEPTION"] = StringId.DataExceptionPleaseTryAgain; + //涓庢湇鍔″櫒閫氳澶辫触 + stateCodeDic[StateCode.NETWORK_ERROR] = StringId.FailedRequestServer; + //鏁版嵁寮傚父 + stateCodeDic[StateCode.DATA_EXCEPTION] = StringId.DataExceptionPleaseTryAgain; + #region 鍩虹鏈嶅姟 鏂伴敊璇爜 2020-12-07 + //绯荤粺绻佸繖~璇风◢鍚庡啀璇晘 + stateCodeDic["1"] = StringId.SystemIsBusy; //绯荤粺缁存姢涓瓇璇风◢鍚庡啀璇晘 - stateCodeDic["2"] = HDL_ON.StringId.SystemMaintenance; + stateCodeDic["2"] = StringId.SystemMaintenance; + ////鏈嶅姟寮傚父 + //stateCodeDic["3"] = StringId.SystemIsBusy; //绛惧悕閿欒 - stateCodeDic["4"] = HDL_ON.StringId.SignatureError; + stateCodeDic["4"] = StringId.SignatureError; + //璇锋眰澶辫触锛屽弬鏁板紓甯革紒 + stateCodeDic["9"] = StringId.RequestFailedParameterException; //楠岃瘉鐮佹牎楠屽け璐� - stateCodeDic["14"] = HDL_ON.StringId.VerificationCodeWrong; + stateCodeDic[StateCode.VERIFICATION_CODE_WRONG] = StringId.VerificationCodeWrong; //楠岃瘉鐮佸彂閫侀绻侊紝璇风◢鍚庡啀璇曪紒 - stateCodeDic["15"] = HDL_ON.StringId.VerificationCodeSentFrequently; + stateCodeDic["15"] = StringId.VerificationCodeSentFrequently; + //楠岃瘉鐮佸彂閫佸け璐� + stateCodeDic["16"] = StringId.FailedToSendVerificationCode; + //浼氳瘽瓒呮椂锛岃鏇存柊token - stateCodeDic[StateCode.TOKEN_EXPIRED] = HDL_ON.StringId.NotLogin; - ////鐧诲綍澶辫触锛岃处鍙锋垨鑰呭瘑鐮侀敊璇� - stateCodeDic["10008"] = HDL_ON.StringId.LoginFailed_AccountOrPasswordError; + stateCodeDic[StateCode.TOKEN_EXPIRED] = StringId.NotLogin; + //瑙f瀽鐢ㄦ埛韬唤閿欒锛岃閲嶆柊鐧诲綍 + stateCodeDic["10006"] = StringId.InvalidToken; + //鎮ㄥ凡鍦ㄥ彟涓�涓澶囩櫥褰� + stateCodeDic["10007"] = StringId.LoggedOnOtherDevices; + //鐧诲綍澶辫触锛岃处鍙锋垨鑰呭瘑鐮侀敊璇� + stateCodeDic["10008"] = StringId.LoginFailed_AccountOrPasswordError; + //鐢ㄦ埛宸茬粡琚鐢� + stateCodeDic["10009"] = StringId.TheAccountHasBeenDisabled; //璐﹀彿涓嶅瓨鍦� - stateCodeDic[StateCode.ACCOUNT_NOT_EXIST] = HDL_ON.StringId.AccountNotExist; + stateCodeDic[StateCode.ACCOUNT_NOT_EXIST] = StringId.AccountNotExist; + //鐢ㄦ埛鏈櫥褰� + stateCodeDic["10011"] = StringId.InvalidToken; //璐﹀彿宸插瓨鍦� - stateCodeDic["10012"] = HDL_ON.StringId.AccountExist; + stateCodeDic["10012"] = StringId.AccountExist; + //鎵嬫満鍙峰凡娉ㄥ唽 + stateCodeDic["10013"] = StringId.AccountExist; + //閭宸叉敞鍐� + stateCodeDic["10014"] = StringId.AccountExist; + //鍘熷瘑鐮侀敊璇� + stateCodeDic["10015"] = StringId.OldPwdNoYes; + //缁戝畾鍙风爜閲嶅 + stateCodeDic["10016"] = StringId.DuplicateBindingNumber; + //娉ㄥ唽澶辫触 + stateCodeDic["10017"] = StringId.RegistrationFailedPleaseTryAgain; + ////绉熸埛涓嶅瓨鍦� + //stateCodeDic["10018"] = StringId.10018; + //瀵嗙爜閿欒娆℃暟杩囧锛岃处鍙疯閿佸畾锛� + stateCodeDic["10019"] = StringId.AccountLoginLock; + //娌℃湁鏉冮檺 + stateCodeDic["10105"] = StringId.PermissionDenied; + //楠岃瘉鐮佸凡缁忓彂閫� + stateCodeDic["10207"] = StringId.VerificationCodePrompt; + //鍙戦�侀獙璇佺爜閿欒 + stateCodeDic["10210"] = StringId.VerificationCodeWrong; + + + + + ////鏋氫妇绫诲瀷閿欒 + //stateCodeDic["11003"] = StringId.11003; + + //-------------------瀛愯处鍙锋ā鍧�------------------- + //瀛愯处鍙峰凡缁忓瓨鍦� + stateCodeDic["10301"] = StringId.BindSubAccount_Exist; + //瀛愯处鍙蜂笉瀛樺湪 + stateCodeDic["10302"] = StringId.SubAccount_NoExists; + //涓嶈兘鎶婅嚜宸辨坊鍔犱负鎴愬憳 + stateCodeDic["10303"] = StringId.BindSubAccount_SameAccount; + ////鐩稿悓鐨勮繙绋嬫帶鍒� + //stateCodeDic["10304"] = StringId.uOperationFailed; + ////瀛愯处鍙锋樀绉板凡缁忓瓨鍦� + //stateCodeDic["10305"] = StringId.BindSubAccount_Exist; + //-------------------浣忓畢妯″潡------------------- + //褰撳墠浣忓畢涓嶅睘浜庤璐﹀彿 + stateCodeDic["10401"] = StringId.HomeIdAndTokenNoConsistent; + //浣忓畢鍚嶇О宸插瓨鍦� + stateCodeDic["10402"] = StringId.HomeName_Exist; + ////浣忓畢ID宸插瓨鍦� + //stateCodeDic["10403"] = StringId.HOME_ID_EXISTS; + //浣忓畢涓嶅瓨鍦� + stateCodeDic["10404"] = StringId.Home_NoExists; + //浣忓畢娌℃湁缁戝畾缃戝叧 + stateCodeDic["10503"] = StringId.PleaseBindTheGatewayFirst; + ////璋冪敤鐢ㄦ埛妯″潡鎺ュ彛澶辫触 //stateCodeDic["10213"] = HDL_ON.StringId; + + //*********缃戝叧********* + //缃戝叧涓嶅瓨鍦� + stateCodeDic["10506"] = StringId.GatewayDoesNotExist; + + + //鎺у埗澶辫触 + stateCodeDic["14007"] = StringId.ControlFailure; + //缃戝叧绂荤嚎 + stateCodeDic["14005"] = StringId.GatewayOffline; + //璁惧绂荤嚎 + stateCodeDic["14006"] = StringId.DeviceOffline; + + //*********鍦烘櫙/鑷姩鍖�********* + //鍦烘櫙宸插瓨鍦� + stateCodeDic["14501"] = StringId.SceneAlreadyExists; + //鑷姩鍖栧凡瀛樺湪 + stateCodeDic["14502"] = StringId.AutomationAlreadyExists; + + //*********璁惧********* + //璁惧鐩爣閲嶅 + stateCodeDic["10801"] = StringId.DuplicateDeviceTarget; + //娌℃湁杩滅▼鎺у埗鏉冮檺 + stateCodeDic["10802"] = StringId.NoRemoteControlPermission; + //璁惧涓嶈兘涓虹┖ + stateCodeDic["10803"] = StringId.TheDeviceCannotBeEmpty; + //鐢ㄦ埛娌℃湁璁惧鐨勬潈闄� + stateCodeDic["10804"] = StringId.NotHavePermissionToTheDevice; + //璁惧涓嶅瓨鍦� + stateCodeDic["10805"] = StringId.TheDeviceDoesNotExist; + + //鎺у埗澶辫触 + stateCodeDic["20000"] = StringId.ControlFailure; + //缃戝叧绂荤嚎 + stateCodeDic["20001"] = StringId.GatewayOffline; + //璁惧绂荤嚎 + stateCodeDic["20002"] = StringId.DeviceOffline; + //spk涓嶆敮鎸佽鍔熻兘 + stateCodeDic["20101"] = StringId.SpkNotSupportThisFeature; + //spk鍔熻兘涓嶆敮鎸佹鍔熻兘鍊� + stateCodeDic["20102"] = StringId.SpkNotSupportThisFunctionValue; + + + #endregion - - ////return; - //#region 2020-09-18 鏂板鎺ラ敊璇爜 - //////鎿嶄綔澶辫触锛岃閲嶈瘯 - ////stateCodeDic ["10001"] = HDL_ON.StringId.uOperationFailed; - ////璇锋眰鍙傛暟閿欒 - //stateCodeDic["10101"] = HDL_ON.StringId.uParameterError; - ////鏃犳晥鐧诲綍Token - //stateCodeDic["10102"] = HDL_ON.StringId.uNoLogin; - ////鐧诲綍澶辫触锛岃处鍙锋垨鑰呭瘑鐮侀敊璇� - //stateCodeDic["10103"] = HDL_ON.StringId.Accountorpassworderro; - ////娌℃湁璁板綍 - //stateCodeDic["10104"] = HDL_ON.StringId.NoRecord; - ////鎿嶄綔鏉冮檺涓嶈冻 - //stateCodeDic["10105"] = HDL_ON.StringId.uBeRestrict; - ////涓嶅瓨鍦� - //stateCodeDic["10106"] = HDL_ON.StringId.NO_EXISTS; - - - ////-------------------鐢ㄦ埛妯″潡------------------- - ////璐﹀彿涓嶅瓨鍦� - //stateCodeDic["10201"] = HDL_ON.StringId.uAccountNoExists; - ////璐﹀彿宸茬粡瀛樺湪 - //stateCodeDic["10202"] = HDL_ON.StringId.RegisterSendVerCode_Exist; - ////楠岃瘉鐮佸凡澶辨晥 - //stateCodeDic["10203"] = HDL_ON.StringId.ValidatorCode_NoRecord; - ////楠岃瘉鐮侀敊璇� - //stateCodeDic["10204"] = HDL_ON.StringId.VerificationCodeError; - - - ////鐧诲綍澶辫触锛屽瘑鐮侀敊璇� - //stateCodeDic["10205"] = HDL_ON.StringId.PasswordIsError; - ////楠岃瘉鐮佹棤鏁圼鐢ㄦ埛娌℃湁閫氳繃鎵嬫満[閭]鍙疯幏鍙栭獙璇佺爜] - //stateCodeDic["10206"] = HDL_ON.StringId.ValidatorCode_ValidCodeAndPhoneNoEqual; - ////楠岃瘉鐮佸彂閫侀绻� - //stateCodeDic["10207"] = HDL_ON.StringId.VERIFY_CODE_SENDED; - ////璇ヨ处鍙峰凡缁忕粦瀹� - //stateCodeDic["10208"] = HDL_ON.StringId.Exist; - ////鐢ㄦ埛鍚嶇О宸茬粡瀛樺湪 - //stateCodeDic["10209"] = HDL_ON.StringId.Exist; - ////楠岃瘉鐮佸彂閫佸け璐� - //stateCodeDic["10210"] = HDL_ON.StringId.RegisterSendVerCode_SendFail; - - ////-------------------鏇存柊瀵嗙爜妯″潡------------------- - ////鍘熷瘑鐮佸拰鏂板瘑鐮佺浉鍚� - //stateCodeDic["10211"] = HDL_ON.StringId.UpdatePassword_NewPasswordAndOldPasswordEqual; - ////鏃у瘑鐮佷笉瀵� - //stateCodeDic["10212"] = HDL_ON.StringId.UpdatePassword_OldPwdNoYes; - - ////-------------------瀛愯处鍙锋ā鍧�------------------- - ////瀛愯处鍙峰凡缁忓瓨鍦� - //stateCodeDic["10301"] = HDL_ON.StringId.BindSubAccount_Exist; - ////瀛愯处鍙蜂笉瀛樺湪 - //stateCodeDic["10302"] = HDL_ON.StringId.uAccountNoExists; - ////涓嶈兘鎶婅嚜宸辨坊鍔犱负鎴愬憳 - //stateCodeDic["10303"] = HDL_ON.StringId.BindSubAccount_SameAccount; - ////涓�鏍风殑杩滅▼璇锋眰 - //stateCodeDic["10304"] = HDL_ON.StringId.uOperationFailed; - ////璐﹀彿宸茬粡瀛樺湪浜庢浣忓畢 - //stateCodeDic["10305"] = HDL_ON.StringId.BindSubAccount_Exist; - - ////-------------------浣忓畢妯″潡------------------- - ////褰撳墠浣忓畢涓嶅睘浜庤璐﹀彿 - //stateCodeDic["10401"] = HDL_ON.StringId.HomeIdAndTokenNoConsistent; - ////浣忓畢鍚嶇О宸插瓨鍦� - //stateCodeDic["10402"] = HDL_ON.StringId.EditZigbeeHome_Exist; - ////浣忓畢ID宸插瓨鍦� - //stateCodeDic["10403"] = HDL_ON.StringId.HOME_ID_EXISTS; - ////浣忓畢涓嶅瓨鍦� - //stateCodeDic["10404"] = HDL_ON.StringId.uZigbeeHome_NoRecord; - - ////-------------------浣忓畢鍒嗕韩妯″潡------------------- - ////浣忓畢鍒嗕韩涓嶅瓨鍦� - //stateCodeDic["10405"] = HDL_ON.StringId.NO_EXISTS; - - ////-------------------缃戝叧妯″潡------------------- - ////鏄惁寮哄埗瑙g粦缃戝叧 - //stateCodeDic["10501"] = HDL_ON.StringId.BindGwToHome_BindGatewaysExists; - ////搴旂敤鎴愬姛 - //stateCodeDic["10502"] = HDL_ON.StringId.AmendTheSuccess; - ////褰撳墠浣忓畢涓嬪苟娌℃湁缁戝畾鎸囧畾鐨勭綉鍏� - //stateCodeDic["10503"] = HDL_ON.StringId.ReleaseGatewayToZigbeeHome_NoBind; - ////涓嶆敮鎸� - //stateCodeDic["10504"] = HDL_ON.StringId.NOT_SUPPORT; - ////缃戝叧MAC涓嶅瓨鍦� - //stateCodeDic["10505"] = HDL_ON.StringId.MACError; - - ////-------------------澶囦唤妯″潡------------------- - ////澶囨敞鍚嶇О宸茬粡瀛樺湪,璇锋洿鎹㈠悗閲嶈瘯锛佹枃浠跺す鍚嶇О宸茬粡瀛樺湪 - //stateCodeDic["10601"] = HDL_ON.StringId.uBackupNameExists; - ////澶囦唤鏂囦欢澶逛笉瀛樺湪 - //stateCodeDic["10602"] = HDL_ON.StringId.FolderNoExist; - ////澶囦唤鏂囦欢涓嶅瓨鍦� - //stateCodeDic["10603"] = HDL_ON.StringId.FileNoExist; - - - ////-------------------璺ㄥ尯------------------- - ////璇ユ帴鍙d笉瀛樺湪璺ㄥ尯鎿嶄綔 - //stateCodeDic["11001"] = HDL_ON.StringId.NOT_SUPPORT; - ////璺ㄥ尯璋冪敤澶辫触 - //stateCodeDic["11002"] = HDL_ON.StringId.NOT_SUPPORT; - ////鏋氫妇閿欒 - //stateCodeDic["11003"] = HDL_ON.StringId.uOperationFailed; - #endregion @@ -222,7 +232,7 @@ // return Language.StringByID(dicMsg[requestName][statuCode]); //} - return Language.StringByID(HDL_ON.StringId.FailedRequestServer) + "\n(" + statuCode + ")"; + return Language.StringByID(StringId.FailedRequestServer) + "\n(" + statuCode + ")"; } @@ -233,7 +243,7 @@ /// <param name="statuCode"></param> /// <param name="isTipStyle"></param> /// <param name="tipStr">琛ュ厖鐨勯敊璇彁绀�</param> - public void ShowErrorInfoAlter(string statuCode, bool isTipStyle = true, int closeTime = 2, string tipStr = "") + public void ShowErrorInfoAlter(string statuCode, bool isTipStyle = true, int closeTime = 2, string tipStr = "",bool showAllMsg = true) { try { @@ -248,7 +258,13 @@ if (mes == null) return; if (!string.IsNullOrEmpty(tipStr)) { - mes = tipStr + "\n" + mes; + if (showAllMsg) + { + mes = tipStr + "\n" + mes; + }else + { + mes = tipStr; + } } if (isTipStyle) { @@ -267,7 +283,7 @@ { Application.RunOnMainThread(() => { - new Alert("", mes, Language.StringByID(HDL_ON.StringId.Close)).Show(); + new Alert("", mes+$" \r\nCode:{statuCode}", Language.StringByID(StringId.Close)).Show(); }); } } @@ -278,7 +294,7 @@ /// <summary> /// StartRefreshToken /// </summary> - void StartRefreshToken() + public void StartRefreshToken() { if (isGetingToken) return; @@ -289,7 +305,7 @@ try { var success = new HttpServerRequest().RefreshToken(); - if (success) { + if (success == StateCode.SUCCESS) { Utlis.WriteLine("RefreshToken success"); } } @@ -312,18 +328,38 @@ public class StateCode { /// <summary> + /// 缃戠粶璇锋眰寮傚父 + /// APP鑷畾涔夐敊璇爜 + /// </summary> + public const string NETWORK_ERROR = "-1"; + /// <summary> + /// 鏁版嵁瑙f瀽閿欒 + /// APP鑷畾涔夐敊璇爜 + /// </summary> + public const string DATA_EXCEPTION = "-2"; + /// <summary> /// 璇锋眰鎴愬姛鐨勭姸鎬佺爜 /// </summary> public const string SUCCESS = "0"; /// <summary> - /// 璐﹀彿涓嶅瓨鍦ㄧ殑閿欒鐮� + /// 楠岃瘉鐮佹牎楠屽け璐� /// </summary> - public const string ACCOUNT_NOT_EXIST = "10010"; - + public const string VERIFICATION_CODE_WRONG = "14"; /// <summary> /// 浼氳瘽瓒呮椂锛岃鏇存柊token /// </summary> public const string TOKEN_EXPIRED = "10001"; + /// <summary> + /// 璐﹀彿涓嶅瓨鍦ㄧ殑閿欒鐮� + /// </summary> + public const string ACCOUNT_NOT_EXIST = "10010"; + /// <summary> + /// 鐧诲綍閿佸畾锛屽瘑鐮侀敊璇鏁拌繃澶� + /// 瀵嗙爜杈撳叆閿欒瓒呰繃10娆★紝璇�30鍒嗛挓鍚庨噸璇�! + /// </summary> + public const string AccountLoginLock = "10019"; + + } } -- Gitblit v1.8.0