public HttpResponseMessage PostPasswordRecoverySend(PasswordRecoveryModel value) { if (string.IsNullOrWhiteSpace(value.UserName)) { return(ReturnResult(string.Empty, 1, "不能传入空的参数值")); } try { var ResultStatus = 0; var ErrorMessage = string.Empty; var customer = _customerService.GetCustomerByUsername(value.UserName); if (customer != null && customer.Active && !customer.Deleted) { Random rd = new Random(); int newPassword = rd.Next(100000, 1000000); //save token and current date var changePasswordResult = _customerRegistrationService.ResetPassword(_customerSettings.DefaultPasswordFormat, value.UserName, newPassword.ToString()); if (changePasswordResult.Success) { //send SMS //_sendNoticeService.SendNewPassword(customer.Mobile, newPassword.ToString()); //_workflowMessageService.SendCustomerPasswordRecoveryMessage(customer, _workContext.WorkingLanguage.Id, newPassword.ToString()); ResultStatus = 0; ErrorMessage = _localizationService.GetResource("Account.PasswordRecovery.SMSHasBeenSent"); } } else { ResultStatus = 1; ErrorMessage = _localizationService.GetResource("Account.PasswordRecovery.MobileNotFound"); } return(ReturnResult(string.Empty, ResultStatus, ErrorMessage)); } catch (Exception ex) { LogException(ex); return(ReturnResult(string.Empty, 1, "读取数据出现错误")); } }