//修改密码 public ActionResult MPwd() { ModifyTowPwdParamter param = GetRequestParamter <ModifyTowPwdParamter>(); //ActionResult ar = AnalysisToken(param, out bool isret, out tMembersEntity member); //if (isret) // return ar; tMobileMsgEntity _msg = tMobileMsgBLL.Instance.GetLastUnUseMsgByMobile(param.mobile, MobileMsgFuncEnum.FindPwd.GetHashCode()); if (_msg == null || !param.vcode.Equals(_msg.validCode)) { return(RetJsonResult(ApiResponseCodeEnum.Fail, "验证码不正确")); } if (param.pwd.Length < 8) { return(RetJsonResult(ApiResponseCodeEnum.Fail, "密码不能少于8位")); } if (!param.pwd.IsValidPwd()) { return(RetJsonResult(ApiResponseCodeEnum.Fail, "密码格式不正确")); } if (!param.pwd.Equals(param.surepwd)) { return(RetJsonResult(ApiResponseCodeEnum.Fail, "密码与确认密码不一致")); } tMembersEntity _member = tMembersBLL.Instance.GetModelByMobile(param.mobile); if (_member == null) { return(RetJsonResult(ApiResponseCodeEnum.Fail, "手机号未注册")); } int _temp_userId = _member.mbId; _member = new tMembersEntity() { mbId = _temp_userId, mbPwd = MD5Helper.PwdEncryption(param.pwd) }; if (tMembersBLL.Instance.SubmitForm(_member, _member.mbId)) { return(RetJsonResult(ApiResponseCodeEnum.Success, "修改成功")); } return(RetJsonResult(ApiResponseCodeEnum.Fail, "修改失败")); }
//获取短信验证码 public ActionResult GetVCode() { VCodeParamter param = GetRequestParamter <VCodeParamter>(); //ActionResult ar = AnalysisToken(param, out bool isret, out tMembersEntity member); //if (isret) // return ar; if (param.mobile.IsEmpty() || !param.mobile.IsValidTel()) { return(RetJsonResult(ApiResponseCodeEnum.ParamterFormatError, "手机号格式不正确")); } if (param.func <= 0) { return(RetJsonResult(ApiResponseCodeEnum.ParamterFormatError, "验证码功能code不正确")); } tMobileMsgEntity _msg = tMobileMsgBLL.Instance.GetLastUnUseMsgByMobile(param.mobile); if (_msg != null) { if ((DateTime.Now - _msg.sendTime).TotalSeconds < 60) { return(RetJsonResult(ApiResponseCodeEnum.ParamterFormatError, "操作太频繁,请稍后再试")); } } string rannum = "123456"; //RandHelp.GetRnd(6); _msg = new tMobileMsgEntity() { mobileNumber = param.mobile, msgContent = string.Format("您的验证码是{0},5分钟内有效。如非本人操作,请忽略本短信", rannum), validCode = rannum, sendTime = DateTime.Now, expireTime = DateTime.Now.AddMinutes(5), msgpfResponse = string.Empty, msgpfStatusCode = string.Empty, useStatus = YesNoEnum.No.GetHashCode(), msgFuncId = param.func }; //SMSHelper sms = new SMSHelper //{ // ToTel = param.mobile, // Info = _msg.msgContent //}; //string error = string.Empty, msgId = string.Empty, statuscode = string.Empty; //sms.Send(ref error, ref msgId, ref statuscode); //_msg.msgpfResponse = error; //_msg.msgpfStatusCode = statuscode; //_msg.msgpfmsgId = msgId; //if (!statuscode.Equals("0")) //{ // return RetJsonResult(ApiResponseCodeEnum.ParamterFormatError, "短信发送失败"); //} if (GetOneInstance <tMobileMsgBLL> .Instance.SubmitForm(_msg, _msg.msgId)) { return(RetJsonResult(ApiResponseCodeEnum.Success, "", rannum)); } return(RetJsonResult(ApiResponseCodeEnum.Fail, "获取失败")); }