예제 #1
0
        public JsonResult PhoneInfo(PhoneInfoModel model)
        {
            JsonModel jm = new JsonModel();

            var owner = GetCurrentUser();

            if (owner != null)
            {
                //判断验证码是否正确
                IPhoneValidateBLL phoneValidateBll = BLLFactory <IPhoneValidateBLL> .GetBLL("PhoneValidateBLL");

                var val = phoneValidateBll.GetEntity(v => v.PhoneNum == model.Phone && v.ActionCode == 0);


                //如果验证码不准确
                if (val == null && model.VerityCode != val.ValidateCode)
                {
                    jm.Msg = APIMessage.VALIDATE_ERROR;
                    return(Json(jm, JsonRequestBehavior.AllowGet));
                }

                //验证码已失效
                if (val.InvalidTime < DateTime.Now)
                {
                    jm.Msg = APIMessage.VALIDATE_INVALID;
                    return(Json(jm, JsonRequestBehavior.AllowGet));
                }
                owner.Phone = model.Phone;

                IUserBLL ownerBll = BLLFactory <IUserBLL> .GetBLL("UserBLL");

                ownerBll.Update(owner);
            }
            else
            {
                jm.Msg = "该用户不存在";
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }