public APIResponse GetForgetPwdCode(GetForgetPwdCodeModel model) { var clientUser = CurrentDb.SysClientUser.Where(m => m.UserName == model.Phone).FirstOrDefault(); if (clientUser == null) { return ResponseResult(ResultType.Failure, ResultCode.Failure, "用户手机不正确"); } string token = ""; string validCode = ""; int seconds = 0; IResult iResult = BizFactory.Sms.SendGetForgetPwdCode(clientUser.Id, clientUser.PhoneNumber, out validCode, out token, out seconds); if (iResult.Result != ResultType.Success) { return ResponseResult(ResultType.Failure, ResultCode.Failure, iResult.Message); } GetForgetPwdCodeResultModel resultModel = new GetForgetPwdCodeResultModel(); resultModel.UserName = clientUser.UserName; resultModel.Phone = clientUser.PhoneNumber; resultModel.ValidCode = validCode; resultModel.Token = token; resultModel.Seconds = seconds; return ResponseResult(ResultType.Success, ResultCode.Success, "发送成功,请查阅手机", resultModel); }
public APIResponse GetForgetPwdCode(GetForgetPwdCodeModel model) { var clientUser = CurrentDb.SysClientUser.Where(m => m.UserName == model.UserName && m.PhoneNumber == model.Phone).FirstOrDefault(); if (clientUser == null) { return(ResponseResult(ResultType.Failure, ResultCode.Failure, "用户手机不正确")); } string token = ""; string validCode = ""; IResult iResult = BizFactory.Sms.SendResetPasswordValidCode(clientUser.Id, clientUser.PhoneNumber, out validCode, out token); if (iResult.Result != ResultType.Success) { return(ResponseResult(ResultType.Failure, ResultCode.Failure, "获取短信失败")); } ResetPwdResultModel resultModel = new ResetPwdResultModel(); resultModel.UserName = model.UserName; resultModel.ValidCode = validCode; resultModel.Token = token; return(ResponseResult(ResultType.Success, ResultCode.Success, "获取成功", resultModel)); }