国际化修改
This commit is contained in:
@@ -27,7 +27,8 @@ namespace IRaCIS.Application.Services
|
||||
var exp = new EntityVerifyExp<Menu>()
|
||||
{
|
||||
VerifyExp = u => u.ParentId == menuAddOrUpdateModel.ParentId && u.MenuName == menuAddOrUpdateModel.MenuName,
|
||||
VerifyMsg = "该父节点下已经存在同名的子节点。"
|
||||
//---该父节点下已经存在同名的子节点。
|
||||
VerifyMsg = _localizer["Menu_ParentDupChild"]
|
||||
};
|
||||
|
||||
var menu = await _repository.InsertOrUpdateAsync<Menu, MenuCommand>(menuAddOrUpdateModel, true, exp);
|
||||
@@ -91,7 +92,8 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
if (await menuRepository.AnyAsync(t => t.ParentId == menuId))
|
||||
{
|
||||
return ResponseOutput.NotOk("该节点存在子节点,请在删除子节点后,再删除该节点。");
|
||||
//---该节点存在子节点,请在删除子节点后,再删除该节点。
|
||||
return ResponseOutput.NotOk(_localizer["Menu_ChildExist"]);
|
||||
}
|
||||
|
||||
var success =await menuRepository.BatchDeleteNoTrackingAsync(u => u.Id == menuId);
|
||||
|
||||
@@ -49,7 +49,8 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
if (await _userRepository.WhereIf(userId != null, t => t.Id != userId).AnyAsync(t => t.UserName == userName))
|
||||
{
|
||||
throw new BusinessValidationFailedException("用户名已经存在。");
|
||||
//---用户名已经存在。
|
||||
throw new BusinessValidationFailedException(_localizer["User_UsernameExist"]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +58,8 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
if (await _userRepository.WhereIf(userId != null, t => t.Id != userId).AnyAsync(t => (t.Phone == phone && t.UserTypeId == userTypeId)))
|
||||
{
|
||||
throw new BusinessValidationFailedException("该用户类型中已存在具有相同的电话的用户。");
|
||||
//---该用户类型中已存在具有相同的电话的用户。
|
||||
throw new BusinessValidationFailedException(_localizer["User_PhoneDup"]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +68,8 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
if (await _userRepository.WhereIf(userId != null, t => t.Id != userId).AnyAsync(t => (t.EMail == email && t.UserTypeId == userTypeId)))
|
||||
{
|
||||
throw new BusinessValidationFailedException("该用户类型中已存在具有相同邮箱的用户。");
|
||||
//---该用户类型中已存在具有相同邮箱的用户。
|
||||
throw new BusinessValidationFailedException(_localizer["User_EmailDup"]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -79,7 +82,8 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
if (oldPwd != null && oldPwd == newPwd)
|
||||
{
|
||||
throw new BusinessValidationFailedException("新密码与旧密码相同。");
|
||||
//---新密码与旧密码相同。
|
||||
throw new BusinessValidationFailedException(_localizer["User_NewOldPwdSame"]);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,12 +91,14 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
if (oldPwd != null && dbUser.Password != oldPwd)
|
||||
{
|
||||
throw new BusinessValidationFailedException("旧密码验证失败。");
|
||||
//---旧密码验证失败。
|
||||
throw new BusinessValidationFailedException(_localizer["User_OldPwdInvalid"]);
|
||||
}
|
||||
|
||||
if (dbUser.Password == newPwd)
|
||||
{
|
||||
throw new BusinessValidationFailedException("新密码与旧密码相同。");
|
||||
//---新密码与旧密码相同。
|
||||
throw new BusinessValidationFailedException(_localizer["User_NewOldPwdSame"]);
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +119,8 @@ namespace IRaCIS.Application.Services
|
||||
//检查手机或者邮箱是否有效
|
||||
if (!Regex.IsMatch(email, @"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$"))
|
||||
{
|
||||
return ResponseOutput.NotOk("Please input a legal email");
|
||||
//---Please input a legal email
|
||||
return ResponseOutput.NotOk(_localizer["User_LegalEmail"]);
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +147,8 @@ namespace IRaCIS.Application.Services
|
||||
if (verificationRecord == null)
|
||||
{
|
||||
|
||||
return ResponseOutput.NotOk("验证码错误。");
|
||||
//---验证码错误。
|
||||
return ResponseOutput.NotOk(_localizer["User_VerificationCodeError"]);
|
||||
|
||||
}
|
||||
else
|
||||
@@ -148,7 +156,8 @@ namespace IRaCIS.Application.Services
|
||||
//检查验证码是否失效
|
||||
if (verificationRecord.ExpirationTime < DateTime.Now)
|
||||
{
|
||||
return ResponseOutput.NotOk("验证码已经过期。");
|
||||
//---验证码已经过期。
|
||||
return ResponseOutput.NotOk(_localizer["User_VerificationCodeExpired"]);
|
||||
|
||||
}
|
||||
else //验证码正确 并且 没有超时
|
||||
@@ -267,7 +276,8 @@ namespace IRaCIS.Application.Services
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new BusinessValidationFailedException("请检查邮箱地址或者联系维护人员, 邮件发送失败, 未能创建账户成功");
|
||||
//---请检查邮箱地址或者联系维护人员, 邮件发送失败, 未能创建账户成功
|
||||
throw new BusinessValidationFailedException(_localizer["User_CreateFailed"]);
|
||||
}
|
||||
|
||||
|
||||
@@ -296,7 +306,8 @@ namespace IRaCIS.Application.Services
|
||||
if (!Regex.IsMatch(email, @"^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$"))
|
||||
{
|
||||
|
||||
return ResponseOutput.NotOk("请输入一个正确的邮箱。");
|
||||
//---请输入一个正确的邮箱。
|
||||
return ResponseOutput.NotOk(_localizer["User_InvalidEmail"]);
|
||||
|
||||
}
|
||||
|
||||
@@ -305,7 +316,8 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
if (!exist)
|
||||
{
|
||||
return ResponseOutput.NotOk("邮箱错误。");
|
||||
//---邮箱错误。
|
||||
return ResponseOutput.NotOk(_localizer["User_EmailError"]);
|
||||
|
||||
}
|
||||
|
||||
@@ -337,7 +349,8 @@ namespace IRaCIS.Application.Services
|
||||
if (verificationRecord == null)
|
||||
{
|
||||
|
||||
throw new BusinessValidationFailedException("验证码错误。");
|
||||
//---验证码错误。
|
||||
throw new BusinessValidationFailedException(_localizer["User_VerificationCodeError"]);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -345,7 +358,8 @@ namespace IRaCIS.Application.Services
|
||||
if (verificationRecord.ExpirationTime < DateTime.Now)
|
||||
{
|
||||
|
||||
throw new BusinessValidationFailedException("验证码已经过期。");
|
||||
//---验证码已经过期。
|
||||
throw new BusinessValidationFailedException(_localizer["User_VerificationCodeExpired"]);
|
||||
}
|
||||
else //验证码正确 并且 没有超时
|
||||
{
|
||||
@@ -561,7 +575,8 @@ namespace IRaCIS.Application.Services
|
||||
{
|
||||
if (await _userTrialRepository.AnyAsync(t => t.Id == userId))
|
||||
{
|
||||
return ResponseOutput.NotOk("该用户已经参加项目,不能够删除。");
|
||||
//---该用户已经参加项目,不能够删除。
|
||||
return ResponseOutput.NotOk(_localizer["User_InProject"]);
|
||||
}
|
||||
|
||||
var success = await _userRepository.BatchDeleteNoTrackingAsync(t => t.Id == userId);
|
||||
@@ -625,7 +640,8 @@ namespace IRaCIS.Application.Services
|
||||
|
||||
if (loginUser.Status == 0)
|
||||
{
|
||||
return ResponseOutput.NotOk("该用户已经被禁用。", new LoginReturnDTO());
|
||||
//---该用户已经被禁用。
|
||||
return ResponseOutput.NotOk(_localizer["User_Disabled"], new LoginReturnDTO());
|
||||
}
|
||||
|
||||
userLoginReturnModel.BasicInfo = loginUser;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//--------------------------------------------------------------------
|
||||
//--------------------------------------------------------------------
|
||||
// 此代码由T4模板自动生成 byzhouhang 20210918
|
||||
// 生成时间 2021-11-03 09:38:11
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果重新生成代码,这些更改将会丢失。
|
||||
@@ -79,7 +79,8 @@ namespace IRaCIS.Core.Application.Contracts
|
||||
{
|
||||
if ( await _repository.AnyAsync<User>(t => t.UserTypeId == userTypeId))
|
||||
{
|
||||
return ResponseOutput.NotOk("该用户类型中已存在用户,不能删除");
|
||||
//---该用户类型中已存在用户,不能删除
|
||||
return ResponseOutput.NotOk(_localizer["UserType_InUse"]);
|
||||
}
|
||||
|
||||
var success = await userTypeServiceRepository.BatchDeleteNoTrackingAsync(t => t.Id == userTypeId);
|
||||
|
||||
Reference in New Issue
Block a user