コード例 #1
0
        public IHttpActionResult SendPhoneVerification(PhoneVerificationModelGet phoneVerificationModelGet)
        {
            try
            {
                if (phoneVerificationModelGet.PhoneAreaId != "86")
                {
                    return Json(new ResultDataModel<PhoneVerificationModelGet>() { Code = 0, Messages = "检测您当前地点为中国大陆境内,非中国大陆手机号接收验证可能会存在延迟" });
                }
                switch (phoneVerificationModelGet.Type)
                {
                    case "1":
                    case "3":
                        bool exisit = _userInfoDal.ExisitPhone(phoneVerificationModelGet.PhoneAreaId,
                            phoneVerificationModelGet.Phone);
                        if (exisit)
                        {
                            return Json(new ResultDataModel<PhoneVerificationModelGet> { Code = 4101, Messages = "手机号已绑定账号" });
                        }
                        break;
                    case "5":
                        exisit = _userInfoDal.ExisitPhone(phoneVerificationModelGet.PhoneAreaId,
                            phoneVerificationModelGet.Phone);
                        if (!exisit)
                        {
                            return Json(new ResultDataModel<PhoneVerificationModelGet> { Code = 4105, Messages = "手机号未绑定账号" });
                        }
                        break;
                }
                int verificationNo = 666666;
#if DEBUG

#else
                Random random = new Random();
                verificationNo= random.Next(100000, 999999);
                string msg = string.Format("【QQH】您的验证码为{0},有效期10分钟,如非本人操作,请勿回复此短信", verificationNo);
                  if (!PhoneMessagesHelper.SendDdMessages(phoneVerificationModelGet.Phone, msg))
                {
                    LogHelper.error("调用短信发送API失败");
                    throw new Exception();
                }
#endif
                PhoneVerificationCacheHelper.SetCache(phoneVerificationModelGet.PhoneAreaId, phoneVerificationModelGet.Phone, OutTime, phoneVerificationModelGet.Type, verificationNo.ToString());
                return Json(new ResultDataModel<PhoneVerificationModelGet>());
            }
            catch (Exception exception)
            {
                LogHelper.error("短信发送失败" + exception);
                return Json(new ResultDataModel<PhoneVerificationModelGet> { Code = -1, Messages = "短信发送失败" });
            }
        }
コード例 #2
0
        /// <summary>
        /// 找回登录密码
        /// </summary>
        /// <returns></returns>
        public IHttpActionResult RetrieveLoginPassword(RetrieveLoginPasswordModelGet modelGet)
        {
            bool exisit = PhoneVerificationCacheHelper.CheckVerification(modelGet.PhoneAreaId, modelGet.Phone, "5", modelGet.VerificationCode);

            if (!exisit)
            {
                return(Json(new ResultDataModel <CompanyAccountInfoModelResult> {
                    Code = 4102, Messages = "手机和验证码不匹配"
                }));
            }
            int rows = _accountInfoDal.RetrieveLoginPassword(modelGet.PhoneAreaId, modelGet.Phone, modelGet.LoginPassword);

            return(Json(new ResultDataModel <CompanyAccountInfoModelResult> {
                Code = rows == 1 ? 0 : -1
            }));
        }
コード例 #3
0
        /// <summary>
        /// 修改支付密码
        /// </summary>
        /// <param name="updatePayPasswordModel"></param>
        /// <returns></returns>
        public IHttpActionResult UpdatePayPassword(UpdatePayPasswordModel updatePayPasswordModel)
        {
            bool exisit = PhoneVerificationCacheHelper.CheckVerification(updatePayPasswordModel.PhoneAreaId,
                                                                         updatePayPasswordModel.Phone, "4", updatePayPasswordModel.VerificationCode);

            if (!exisit)
            {
                return(Json(new ResultDataModel <CompanyAccountInfoModelResult> {
                    Code = 4102, Messages = "手机和验证码不匹配"
                }));
            }
            int rows = _accountInfoDal.UpdatePayPassword(updatePayPasswordModel.Id, updatePayPasswordModel.PayPassword);

            return(Json(new ResultDataModel <CompanyAccountInfoModelResult> {
                Code = rows == 1 ? 0 : -1
            }));
        }
コード例 #4
0
 /// <summary>
 /// 注册用户
 /// </summary>
 /// <returns></returns>
 public IHttpActionResult RegisterUserInfo(UserInfoRegisterModelGet userInfoRegisterModelGet)
 {
     try
     {
         bool exisit = PhoneVerificationCacheHelper.CheckVerification(userInfoRegisterModelGet.PhoneAreaId, userInfoRegisterModelGet.Phone, "1", userInfoRegisterModelGet.VerificationCode);
         if (!exisit)
         {
             return(Json(new ResultDataModel <CompanyAccountInfoModelResult> {
                 Code = 4102, Messages = "手机和验证码不匹配"
             }));
         }
         DataTable dtPromotionInfo = _fansDal.QueryPromotionInfo(userInfoRegisterModelGet.PromotionCode);
         if (dtPromotionInfo.Rows.Count < 1)
         {
             return(Json(new ResultDataModel <CompanyAccountInfoModelResult> {
                 Code = 4103, Messages = "推广码不存在"
             }));
         }
         bool isExisit = _accountInfoDal.CheckPhone(userInfoRegisterModelGet.Phone, userInfoRegisterModelGet.PhoneAreaId);
         if (isExisit)
         {
             return(Json(new ResultDataModel <CompanyAccountInfoModelResult> {
                 Code = -1, Messages = "手机号已注册,请直接登录"
             }));
         }
         int registered = _accountInfoDal.RegisterUserInfo(userInfoRegisterModelGet.Phone, userInfoRegisterModelGet.PhoneAreaId, userInfoRegisterModelGet.Password, Convert.ToInt32(dtPromotionInfo.Rows[0]["UId"]), Convert.ToInt32(dtPromotionInfo.Rows[0]["Id"]));
         if (registered == -2)
         {
             return(Json(new ResultDataModel <CompanyAccountInfoModelResult> {
                 Code = -1, Messages = "该手机号已注册"
             }));
         }
         return(Json(new ResultDataModel <CompanyAccountInfoModelResult> {
             Code = registered == 1 ? 0 : -1, Messages = registered == 1 ? "" : "注册失败"
         }));
     }
     catch (Exception exception)
     {
         LogHelper.error(exception.Message);
         return(Json(new ResultDataModel <CompanyAccountInfoModelResult> {
             Code = -1, Messages = "服务器内部出现错误"
         }));
     }
 }
コード例 #5
0
 public IHttpActionResult CheckPhoneVerification(CheckPhoneVerificationModelGet checkPhoneVerificationModelGet)
 {
     bool exisit = PhoneVerificationCacheHelper.CheckVerification(checkPhoneVerificationModelGet.PhoneAreaId, checkPhoneVerificationModelGet.Phone, checkPhoneVerificationModelGet.Type, checkPhoneVerificationModelGet.VerificationCode);
     return Json(new ResultDataModel<PhoneVerificationModelGet> { Code = exisit ? 0 : -1, Messages = exisit ? "" : "验证码不存在或不匹配" });
 }