Example #1
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="_"></param>
        /// <returns></returns>
        public string ModifyPassword(dynamic _)
        {
            //接收request数据
            var recdata = this.GetResquetData <LoginInModel>();

            //   WriteInfoLog("LoginModule", recdata.data.MobileCode, recdata.DeviceId, "测试::" + Json.ToJson(recdata));
            try
            {
                #region "接口调用验证"
                //bool flag = DataValidation(recdata.DateTime, recdata.Random, recdata.Sign);

                //if (!flag)
                //{
                //    return this.WriteValidationLog("LoginModule", recdata.DeviceId);
                //}
                #endregion

                //获取快捷登陆验证码是否正确
                CommonBusiness comBll = new CommonBusiness();
                SmsModel       smInfo = comBll.GetLastVerifiCode(recdata.data.MobileCode, "1002");
                if (smInfo == null)
                {
                    return(SendData("验证码不存在", ResponseType.Fail));
                }
                else if (smInfo.IsUser == 1)
                {
                    return(SendData("验证码已使用", ResponseType.Fail));
                }
                else if (smInfo.VerificationCode != recdata.data.VerificationCode)
                {
                    return(SendData("验证码不正确", ResponseType.Fail));
                }
                else
                {
                    int i = comBll.UpdateSmsUsingById(smInfo.Id);
                    if (i != 1)
                    {
                        return(SendData("验证码状态修改失败!", ResponseType.Fail));
                    }
                    LoginBusiness bl      = new LoginBusiness();
                    int           iUpdate = bl.ModifyPassword(recdata.data.MobileCode, recdata.data.Password);
                    if (iUpdate == 1)
                    {
                        WriteInfoLog("LoginModule", recdata.data.MobileCode, recdata.DeviceId, "密码修改成功!");
                        return(SendData("密码修改成功!", ResponseType.Success));
                    }
                    else
                    {
                        return(SendData("密码修改失败!", ResponseType.Fail));
                    }
                }
            }
            catch (Exception ex)
            {
                return(this.WriteExceptionLog("LoginModule", recdata.data.MobileCode, recdata.DeviceId, "密码修改异常:" + Json.ToJson(recdata) + "[异常信息:" + ex.Message + "]", "密码修改异常:" + ex.Message));
            }
        }
Example #2
0
        public string GetLastVerifiCode(dynamic _)
        {
            //接收request数据
            var recdata = this.GetResquetData <SmsModel>();

            try
            {
                #region "接口调用验证"
                //bool flag = DataValidation(recdata.DateTime, recdata.Random, recdata.Sign);

                //if (!flag)
                //{
                //    return this.WriteValidationLog("LoginModule", recdata.DeviceId);
                //}
                #endregion

                CommonBusiness bl          = new CommonBusiness();
                LoginOutModel  accountInfo = bl.CheckTelphone(recdata.data.MobileCode);
                if (accountInfo == null)
                {
                    return(SendData("手机号不存在,请检查账户!", ResponseType.Fail));
                }
                else if (accountInfo.State == 1)
                {
                    return(SendData("手机号已冻结!", ResponseType.Fail));
                }
                else if (accountInfo.State == 2)
                {
                    return(SendData("手机号已注销!", ResponseType.Fail));
                }
                else
                {
                    SmsModel smsInfo = bl.GetLastVerifiCode(recdata.data.MobileCode, recdata.data.CodeType);
                    if (smsInfo != null)
                    {
                        return(this.SendData <SmsModel>(smsInfo, "验证码发送成功!", ResponseType.Success));
                    }
                    else
                    {
                        return(SendData("验证码发送失败!", ResponseType.Fail));
                    }
                }
            }
            catch (Exception ex)
            {
                return(this.WriteExceptionLog("LoginModule", recdata.data.MobileCode, recdata.DeviceId, "验证码发送异常:" + Json.ToJson(recdata) + "[异常信息:" + ex.Message + "]", "验证码发送异常:" + ex.Message));
            }
        }
Example #3
0
        /// <summary>
        /// 短信快捷登陆
        /// </summary>
        /// <param name="_"></param>
        /// <returns></returns>
        public string MessageLogin(dynamic _)
        {
            //接收request数据
            var recdata = this.GetResquetData <LoginInModel>();


            try
            {
                #region "接口调用验证"
                //bool flag = DataValidation(recdata.DateTime, recdata.Random, recdata.Sign);

                //if (!flag)
                //{
                //    return this.WriteValidationLog("LoginModule", recdata.DeviceId);
                //}
                #endregion

                //获取快捷登陆验证码是否正确
                CommonBusiness comBll = new CommonBusiness();
                SmsModel       smInfo = comBll.GetLastVerifiCode(recdata.data.MobileCode, "1001");
                if (smInfo == null)
                {
                    return(SendData("验证码不存在", ResponseType.Fail));
                }
                else if (smInfo.IsUser == 1)
                {
                    return(SendData("验证码已使用", ResponseType.Fail));
                }
                else if (smInfo.VerificationCode != recdata.data.VerificationCode)
                {
                    return(SendData("验证码不正确", ResponseType.Fail));
                }
                else
                {
                    LoginBusiness bl       = new LoginBusiness();
                    LoginOutModel UserInfo = bl.NormalLogin(recdata.data.MobileCode);

                    int TokenTime = Convert.ToInt32(ConfigurationManager.AppSettings["TOKEN_TIME"]);
                    if (UserInfo != null)
                    {
                        if (UserInfo.State == 1)
                        {
                            return(SendData("账户已注销!", ResponseType.Fail));
                        }
                        else
                        {
                            int i = comBll.UpdateSmsUsingById(smInfo.Id);
                            if (i != 1)
                            {
                                return(SendData("验证码状态修改失败!", ResponseType.Fail));
                            }
                            //记录token
                            this.WriteCache(UserInfo.Token, UserInfo.SessionId, TokenTime);

                            WriteInfoLog("LoginModule", recdata.data.MobileCode, recdata.DeviceId, "登陆成功!");



                            return(this.SendData <LoginOutModel>(UserInfo, "登陆成功", ResponseType.Success));
                        }
                    }
                    else
                    {
                        return(SendData("账户不存在!", ResponseType.Fail));
                    }
                }
            }
            catch (Exception ex)
            {
                return(this.WriteExceptionLog("LoginModule", recdata.data.MobileCode, recdata.DeviceId, "登陆异常:" + Json.ToJson(recdata) + "[异常信息:" + ex.Message + "]", "登陆异常:" + ex.Message));
            }
        }