GetReceiveMobile() public static method

通过模块名称获取手机
public static GetReceiveMobile ( string moduleName ) : string
moduleName string
return string
Example #1
0
        /// <summary>
        /// 检验验证码,成功会清除缓存数据
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="code"></param>
        /// <param name="error"></param>
        /// <returns></returns>
        public bool CheckCode(string mobile, string code, out string error)
        {
            error = "";
            if (MobileVerifyData.GetTimes(ModuleName) > 10)
            {
                error = "调用次数超过了限制";
                return(false);
            }
            string code1   = MobileVerifyData.GetCode(ModuleName);
            string mobile1 = MobileVerifyData.GetReceiveMobile(ModuleName);

            if (string.IsNullOrEmpty(code1) || string.IsNullOrEmpty(mobile1))
            {
                error = "请重新发送";
                return(false);
            }
            code  = code.ToLower();
            code1 = code1.ToLower();
            bool a = code == code1 && mobile.Trim() == mobile1.Trim();

            if (a)
            {
                MobileVerifyData.Clear(ModuleName);
            }
            else
            {
                error = "验证码不正确";
            }
            return(a);
        }