예제 #1
0
파일: Step2.ashx.cs 프로젝트: uvbs/mmp
        public void ProcessRequest(HttpContext context)
        {
            string code = context.Request["code"];//手机验证码

            if (string.IsNullOrEmpty(code))
            {
                apiResp.msg = "Please Type The Cell Phone";
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            if (string.IsNullOrEmpty(code))
            {
                apiResp.msg = "Please Type The Code";
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            if (context.Session["Phone"] == null)
            {
                apiResp.msg = "Phone Is Null";
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            var    phone    = context.Session["Phone"].ToString();
            string lastCode = bllSms.GetLastSmsVerificationCode(phone).VerificationCode;

            if (code != lastCode)
            {
                apiResp.msg = "Code Error";
                bllUser.ContextResponse(context, apiResp);
                return;
            }
            else
            {
                context.Session["FindPasswordResult"] = "true";
                apiResp.status = true;
                bllUser.ContextResponse(context, apiResp);
            }
            bllUser.ContextResponse(context, apiResp);
        }
예제 #2
0
파일: Handler.ashx.cs 프로젝트: uvbs/mmp
        /// <summary>
        /// 获取手机领奖验证码
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string GetSmsVercode(HttpContext context)
        {
            //检查是否已经领过了
            int totalCount = 0;

            bllCardCoupon.GetMyCardCoupons(BLLJIMP.Enums.EnumCardCouponType.EntranceTicket, CurrentUserInfo.UserID, 1, 1, out totalCount);

            if (totalCount > 0)
            {
                resp.errcode = 3;
                resp.errmsg  = "您已经领取过热带风暴电子门票了";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            var model = bllVote.GetVoteObjectInfo(bllVote.BeachHoneyVoteID, CurrentUserInfo.UserID);

            if (model == null)
            {
                resp.errcode = 3;
                resp.errmsg  = "您还没有报名";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            else if (!model.Status.Equals(1))
            {
                resp.errcode = 3;
                resp.errmsg  = "您还未通过审核";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            else if (model.Rank > 1000)
            {
                resp.errcode = 3;
                resp.errmsg  = "您没有获奖";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            string phone       = model.Phone;//手机号
            var    lastVerCode = bllSms.GetLastSmsVerificationCode(phone);

            if (lastVerCode != null)
            {
                if ((DateTime.Now - lastVerCode.InsertDate).TotalSeconds < 60)
                {
                    resp.errcode = 2;
                    resp.errmsg  = "验证码限制每60秒发送一次";
                    return(Common.JSONHelper.ObjectToJson(resp));
                }

                resp.errcode = 0;
                resp.errmsg  = "验证码已发送";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            else
            {
            }

            bool   isSuccess = false;
            string msg       = "";
            string verCode   = new Random().Next(111111, 999999).ToString();

            bllSms.SendSmsVerificationCode(phone, string.Format("您的领奖验证码{0}", verCode), "沙滩宝贝", verCode, out isSuccess, out msg);
            if (isSuccess)
            {
                resp.errmsg = "验证码发送成功";
            }
            else
            {
                resp.errcode = 3;
                resp.errmsg  = msg;
            }

            return(Common.JSONHelper.ObjectToJson(resp));
        }
예제 #3
0
        /// <summary>
        /// 注册
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string Reg(HttpContext context)
        {
            int    regType    = int.Parse(context.Request["RegType"]); //注册类型 2销售人员 3海马内部人员
            string phone      = context.Request["Phone"];              //手机号
            string smsVerCode = context.Request["VerCode"];            //手机验证码
            string trueName   = context.Request["TrueName"];


            string province  = context.Request["Province"];  //省份
            string storeName = context.Request["StoreName"]; //门店名称
            string storeCode = context.Request["StoreCode"]; //门店代码

            string position = context.Request["Position"];   //岗位

            string ex1 = context.Request["Ex1"];             //本部
            string ex2 = context.Request["Ex2"];             //部门


            if (bllHaiMa.IsReg(CurrentUserInfo))
            {
                resp.errcode = 8;
                resp.errmsg  = "已经注册过了";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            if ((!Common.ValidatorHelper.PhoneNumLogicJudge(phone)))//验证手机号格式
            {
                resp.errcode = 1;
                resp.errmsg  = "手机号码无效";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            var lastVerCode = bllSms.GetLastSmsVerificationCode(phone);

            if (lastVerCode == null)
            {
                resp.errcode = 2;
                resp.errmsg  = "请先获取验证码";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            if (string.IsNullOrEmpty(smsVerCode))
            {
                resp.errcode = 3;
                resp.errmsg  = "请输入手机验证码";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            if (!smsVerCode.Equals(lastVerCode.VerificationCode))
            {
                resp.errcode = 4;
                resp.errmsg  = "验证码不正确";
                return(Common.JSONHelper.ObjectToJson(resp));
            }
            //检查门店
            if ((bllHaiMa.GetSingleStore(province, storeName, storeCode) == null) && (regType == 2))
            {
                resp.errcode = 5;
                resp.errmsg  = "店代码输入有误,请重新输入";
                return(Common.JSONHelper.ObjectToJson(resp));
            }

            if (bllUser.Get <UserInfo>(string.Format("Phone='{0}' And WebSiteOwner='{1}'", phone, bllUser.WebsiteOwner)) != null)
            {
                resp.errcode = 6;
                resp.errmsg  = "此手机号已经被注册";
                return(Common.JSONHelper.ObjectToJson(resp));
            }

            CurrentUserInfo.Phone    = phone;
            CurrentUserInfo.TrueName = trueName;
            CurrentUserInfo.Province = province;//省份
            CurrentUserInfo.Postion  = position;
            CurrentUserInfo.UserType = regType;
            CurrentUserInfo.Ex1      = ex1;       //本部
            CurrentUserInfo.Ex2      = ex2;       //部门
            CurrentUserInfo.Ex3      = storeName; //销售店名称
            CurrentUserInfo.Ex4      = storeCode; //销售店代码

            string setPar = string.Format(" TrueName='{0}',Phone='{1}',Postion='{2}',UserType={3},Province='{4}',Ex1='{5}',Ex2='{6}',Ex3='{7}',Ex4='{8}'", CurrentUserInfo.TrueName, CurrentUserInfo.Phone, CurrentUserInfo.Postion, CurrentUserInfo.UserType, CurrentUserInfo.Province, CurrentUserInfo.Ex1, CurrentUserInfo.Ex2, CurrentUserInfo.Ex3, CurrentUserInfo.Ex4);

            if (bllUser.Update(CurrentUserInfo, setPar, string.Format(" AutoID={0}", CurrentUserInfo.AutoID)) > 0)
            {
                resp.errmsg = "成功注册";
            }
            else
            {
                resp.errcode = 7;
                resp.errmsg  = "注册失败";
            }

            return(Common.JSONHelper.ObjectToJson(resp));
        }