| | |
| | | /// </summary> |
| | | public bool IgnoreError = false; |
| | | |
| | | /// <summary> |
| | | /// 全部信息 |
| | | /// </summary> |
| | | private Dictionary<string, Dictionary<string, int>> dicMsg = null; |
| | | ///// <summary> |
| | | ///// 全部信息 |
| | | ///// </summary> |
| | | //private Dictionary<string, Dictionary<string, int>> dicMsg = null; |
| | | |
| | | /// <summary> |
| | | /// 通用错误码 |
| | |
| | | /// </summary> |
| | | public void InitAllMsg() |
| | | { |
| | | dicMsg = new Dictionary<string, Dictionary<string, int>>(); |
| | | //dicMsg = new Dictionary<string, Dictionary<string, int>>(); |
| | | #region 共通错误码 |
| | | stateCodeDic = new Dictionary<string, int>(); |
| | | //与服务器通讯失败 |
| | |
| | | #region 基础服务 新错误码 |
| | | //系统维护中~请稍后再试~ |
| | | stateCodeDic["2"] = HDL_ON.StringId.SystemMaintenance; |
| | | //签名错误 |
| | | stateCodeDic["4"] = HDL_ON.StringId.SignatureError; |
| | | //验证码校验失败 |
| | | stateCodeDic["14"] = HDL_ON.StringId.VerificationCodeWrong; |
| | | ////会话超时,请更新token |
| | | //stateCodeDic["10001"] = HDL_ON.StringId.uOperationFailed; |
| | | //验证码发送频繁,请稍后再试! |
| | | stateCodeDic["15"] = HDL_ON.StringId.VerificationCodeSentFrequently; |
| | | //会话超时,请更新token |
| | | stateCodeDic["10001"] = HDL_ON.StringId.NotLogin; |
| | | ////登录失败,账号或者密码错误 |
| | | stateCodeDic["10008"] = HDL_ON.StringId.LoginFailed_AccountOrPasswordError; |
| | | //账号不存在 |
| | | stateCodeDic[StateCode.ACCOUNT_NOT_EXIST] = HDL_ON.StringId.AccountNotExist; |
| | | //#endregion |
| | | //账号已存在 |
| | | stateCodeDic["10012"] = HDL_ON.StringId.AccountExist; |
| | | #endregion |
| | | |
| | | ////return; |
| | | //#region 2020-09-18 新对接错误码 |
| | |
| | | |
| | | #endregion |
| | | |
| | | #endregion |
| | | |
| | | } |
| | | |
| | |
| | | /// <param name="revertObj">云端返回的数据</param> |
| | | /// <param name="pra">请求参数</param> |
| | | /// <returns></returns> |
| | | public string GetMsgByRequestName(string requestName, string statuCode) |
| | | public string GetMsgByRequestName(string statuCode) |
| | | { |
| | | if (IgnoreError == true) |
| | | { |
| | |
| | | return Language.StringByID(stateCodeDic[statuCode]); |
| | | } |
| | | |
| | | if (dicMsg.ContainsKey(requestName) == true && dicMsg[requestName].ContainsKey(statuCode) == true) |
| | | { |
| | | //在册的Msg |
| | | return Language.StringByID(dicMsg[requestName][statuCode]); |
| | | } |
| | | //if (dicMsg.ContainsKey(requestName) == true && dicMsg[requestName].ContainsKey(statuCode) == true) |
| | | //{ |
| | | // //在册的Msg |
| | | // return Language.StringByID(dicMsg[requestName][statuCode]); |
| | | //} |
| | | |
| | | return Language.StringByID(HDL_ON.StringId.FailedRequestServer) + "\n(" + statuCode + ")"; |
| | | } |
| | |
| | | /// <param name="statuCode"></param> |
| | | /// <param name="isTipStyle"></param> |
| | | /// <param name="tipStr">补充的错误提示</param> |
| | | public void ShowErrorInfoAlter(string requestName, string statuCode, bool isTipStyle = false, string tipStr = "") |
| | | public void ShowErrorInfoAlter(string statuCode, bool isTipStyle = true, int closeTime = 2, string tipStr = "") |
| | | { |
| | | try |
| | | { |
| | | string mes = GetMsgByRequestName(requestName, statuCode); |
| | | string mes = GetMsgByRequestName(statuCode); |
| | | if (mes == null) return; |
| | | if (!string.IsNullOrEmpty(tipStr)) |
| | | { |
| | |
| | | } |
| | | if (isTipStyle) |
| | | { |
| | | //MainPage.AddTip(mes); |
| | | Application.RunOnMainThread(() => { |
| | | var tip = new Tip() |
| | | { |
| | | Text = mes, |
| | | CloseTime = closeTime, |
| | | Direction = AMPopTipDirection.None |
| | | }; |
| | | tip.Show(MainPage.BaseView); |
| | | }); |
| | | } |
| | | else |
| | | { |