Esempio n. 1
0
        public ActionResult SendFindPasswordSMS(FormCollection form)
        {
            string cell = CookieHelper.GetCookie <String>("FindPasswordCustomerCellPhone");

            if (!string.IsNullOrEmpty(cell))
            {
                SMSInfo item = new SMSInfo();
                //item.CustomerSysNo = int.Parse(CookieHelper.GetCookie<String>("FindPasswordCustomerSysNo"));
                item.CreateUserSysNo = int.Parse(CookieHelper.GetCookie <String>("FindPasswordCustomerSysNo"));
                item.CellNumber      = cell;
                item.Status          = SMSStatus.NoSend;
                item.Type            = SMSType.FindPassword;
                item.Priority        = 100;
                item.RetryCount      = 0;

                string code = VerifyImage.CreateRandomNumber();

                CookieHelper.SaveCookie <string>("FindPasswordSMSCode", code);
                item.SMSContent = string.Format(AppSettingManager.GetSetting("SMSTemplate", "AlertConfirmPhoneCode"),
                                                DateTime.Now.ToString("MM月dd日 HH:mm"), code);
                if (CommonFacade.InsertNewSMS(item))
                {
                    return(Json("s", JsonRequestBehavior.AllowGet));
                }
            }
            return(Json("服务器忙,稍后重试", JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
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);
        }
Esempio n. 3
0
        public ActionResult SendLoginValidSMS(FormCollection form)
        {
            //step one :get customer cellphone from db
            string customerID = form["CustomerID"];

            if (string.IsNullOrEmpty(customerID))
            {
                return(Json("账户名未提供,发送验证码失败。", JsonRequestBehavior.AllowGet));
            }
            var    customer          = CustomerFacade.GetCustomerByID(customerID);
            string customerCellphone = customer.CellPhone;

            //step two :send sms
            if (string.IsNullOrEmpty(customerCellphone) || customer.IsPhoneValided == 0)
            {
                return(Json("账户未绑定手机或是未完成验证绑定,获取验证码失败。", JsonRequestBehavior.AllowGet));
            }
            else
            {
                SMSInfo item = new SMSInfo();
                item.CreateUserSysNo = customer.SysNo;
                item.CellNumber      = customer.CellPhone;
                item.Status          = SMSStatus.NoSend;
                item.Type            = SMSType.VerifyPhone;
                item.Priority        = 100;
                item.RetryCount      = 0;

                string code = VerifyImage.CreateRandomNumber();
                CookieHelper.SaveCookie <string>("VerifyCode", code);
                item.SMSContent = string.Format(AppSettingManager.GetSetting("SMSTemplate", "CreateConfirmPhoneCode"),
                                                DateTime.Now.ToString("MM月dd日 HH:mm"), code);
                if (CommonFacade.InsertNewSMS(item))
                {
                    return(Json("s", JsonRequestBehavior.AllowGet));
                }
            }
            return(Json("服务器忙,稍后重试", JsonRequestBehavior.AllowGet));
        }