public ActionResult PhoneLogin(string phoneNo, string smscode, bool isAutoLogin)
        {
            string status = "fail";
            string msg    = "短信验证码错误!";

            Model.FormatModel.PhoneSmsCode phoneSmsCode = Session["SmsCode"] as Model.FormatModel.PhoneSmsCode;

            // 校验手机号
            Regex rgx = new Regex("/^0?1[3|4|5|7|8][0-9]\\d{8}$/");

            if (String.IsNullOrWhiteSpace(phoneNo) || !rgx.IsMatch(phoneNo))
            {
                msg = "手机号输入错误,请重新输入!";
            }
            //调试
            //phoneSmsCode = new PhoneSmsCode { PhoneNumber = phoneNo,SmsCode = smscode };
            if (phoneSmsCode != null && phoneSmsCode.PhoneNumber == phoneNo && phoneSmsCode.SmsCode == smscode)
            {
                bool loginResult = OperateContext.Current.UserLogin(new UserInfoView()
                {
                    PhoneAccount = phoneNo
                }, 1, isAutoLogin);

                if (loginResult)
                {
                    Session["SmsCode"] = null;
                    status             = "ok";
                    msg = "登录成功!";
                }
                else
                {
                    msg = "登录失败!";
                }
            }
            else
            {
                msg = "短信验证码错误!";
            }

            return(OperateContext.Current.RedirectAjax(status, msg, null, null));
        }
        public ActionResult CheckAuthCode(string phoneNo, string authCode)
        {
            string status = "fail";
            string msg    = null;

            // 校验手机号
            if (String.IsNullOrWhiteSpace(phoneNo) || !Validate.ValidatePhone(phoneNo))
            {
                msg = "手机号输入错误,请重新输入!";
            }

            if (msg == null)
            {
                if (Session["AuthCode"] != null && Session["AuthCode"].ToString().ToLower() == authCode.ToLower())
                {
                    string smscode = "";
                    Random rand    = new Random();
                    for (int i = 0; i < 4; i++)
                    {
                        smscode += rand.Next(0, 10);
                    }

                    Session["SmsCode"] = new Model.FormatModel.PhoneSmsCode()
                    {
                        PhoneNumber = phoneNo, SmsCode = smscode
                    };


                    UserInfoView userInfo = OperateContext.Current.BLLSession.IUserInfoViewBLL.GetListBy(m => m.PhoneAccount == phoneNo).FirstOrDefault();

                    // 判断用户是否注册
                    if (userInfo != null)
                    {
                        // 判断用户状态
                        if (userInfo.State != 0)
                        {
                            msg = "此账号被禁止登录,请联系客服!";
                        }
                        else
                        {
                            msg = AliyunSMS.SendLoginAuthSMS(phoneNo, smscode);
                        }
                    }
                    else
                    {
                        msg = AliyunSMS.SendRegisterSMS(phoneNo, smscode);
                    }

                    if (msg == "ok")
                    {
                        status = "ok";
                        msg    = "发送短信成功!";
                    }

#if DEBUG
                    msg = smscode;
#endif
                }
                else
                {
                    msg = "验证码错误!";
                }
            }

            Session["AuthCode"] = null;

            return(OperateContext.Current.RedirectAjax(status, msg, null, null));
        }