public ActionResult AjaxSendValidateCellphoneByCode(FormCollection form)
        {
            string cell = Request["CellPhoneNumber"].ToString();

            if (!string.IsNullOrEmpty(cell))
            {
                //判断手机号码是否被验证过
                if (CustomerFacade.PhoneIsValidate(cell))
                {
                    return(Json("此手机号码已经被验证过,不能进行重复验证", JsonRequestBehavior.AllowGet));
                }
                CellPhoneConfirm item = new CellPhoneConfirm();
                item.CustomerSysNo = CurrUser.UserSysNo;
                item.CellPhone     = cell;

                string code = VerifyImage.CreateRandomNumber();

                item.ConfirmKey = code;
                int CellPhoneSysNo = CustomerFacade.CreateCellPhoneConfirm(item).SysNo;
                if (CellPhoneSysNo > 0)
                {
                    return(Json("s", JsonRequestBehavior.AllowGet));
                }

                if (CellPhoneSysNo == -99999)
                {
                    return(Json("同一个IP地址24小时内只能请求验证码10次,同一个手机号码请求验证码5次。", JsonRequestBehavior.AllowGet));
                }
                return(Json("服务器忙,稍后重试", JsonRequestBehavior.AllowGet));
            }
            return(Json("服务器忙,稍后重试", JsonRequestBehavior.AllowGet));
        }
        public ActionResult AjaxSendValidateCellphoneByCode(FormCollection form)
        {
            //return Json("s", JsonRequestBehavior.AllowGet);
            string validatedCode = Request["ValidateCode"].ToString();

            if (CookieHelper.GetCookie <String>("VerifyCode").ToLower() != validatedCode.ToLower())
            {
                return(Json(new JsonResult()
                {
                    ContentType = "验证码不正确", Data = ""
                }, JsonRequestBehavior.AllowGet));
            }


            string cell = Request["CellPhoneNumber"].ToString();

            if (!string.IsNullOrEmpty(cell))
            {
                //判断手机号码是否被验证过
                //if (CustomerFacade.PhoneIsValidate(cell))
                //{
                //    return Json(new JsonResult(){ContentType="此手机号码已经被验证过,不能进行重复验证"} , JsonRequestBehavior.AllowGet);
                //}
                CellPhoneConfirm item = new CellPhoneConfirm();
                item.CustomerSysNo = 0;
                item.CellPhone     = cell;

                string code = VerifyImage.CreateRandomNumber();

                item.ConfirmKey = code;
                int CellPhoneSysNo = CustomerFacade.CreateCellPhoneConfirm(item).SysNo;
                if (CellPhoneSysNo > 0)
                {
                    return(Json(new JsonResult()
                    {
                        ContentType = "s", Data = CellPhoneSysNo
                    }, JsonRequestBehavior.AllowGet));
                }
                if (CellPhoneSysNo == -99999)
                {
                    return(Json(new JsonResult()
                    {
                        ContentType = "同一个IP地址24小时内只能请求验证码10次,同一个手机号码请求验证码5次。"
                    }, JsonRequestBehavior.AllowGet));
                }
                return(Json(new JsonResult()
                {
                    ContentType = "服务器忙,稍后重试"
                }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new JsonResult()
            {
                ContentType = "服务器忙,稍后重试"
            }, JsonRequestBehavior.AllowGet));
        }
示例#3
0
        /// <summary>
        /// 创建手机号码验证对象
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public static CellPhoneConfirm CreateCellPhoneConfirm(CellPhoneConfirm entity)
        {
            var     temp = CustomerDA.CreateCellPhoneConfirm(entity);
            SMSInfo item = new SMSInfo(); //发送验证码短信

            item.CreateUserSysNo = entity.CustomerSysNo;
            item.CellNumber      = entity.CellPhone;
            item.Status          = SMSStatus.NoSend;
            item.Type            = SMSType.VerifyPhone;
            item.Priority        = 100;
            item.RetryCount      = 0;
            item.SMSContent      = string.Format(AppSettingManager.GetSetting("SMSTemplate", "CreateConfirmPhoneCode"), DateTime.Now.ToString("MM月dd日 HH:mm"), entity.ConfirmKey);
            int smsResult = 0;

            CommonFacade.InsertNewSMS(item, out smsResult);
            if (smsResult == -99999)//表明非法发送验证码
            {
                temp       = new CellPhoneConfirm();
                temp.SysNo = -99999;
            }
            return(temp);
        }