style: 错误信息英文返回-featues包

This commit is contained in:
TsMask
2023-11-08 15:01:57 +08:00
parent c53cd9ce16
commit 546c6f165b
10 changed files with 43 additions and 21 deletions

View File

@@ -97,17 +97,17 @@ func (r *ServiceSysRole) DeleteRoleByIds(roleIds []string) (int64, error) {
// 检查是否存在
roles := r.sysRoleRepository.SelectRoleByIds(roleIds)
if len(roles) <= 0 {
return 0, errors.New("没有权限访问角色数据!")
return 0, errors.New("no permission to access role data")
}
for _, role := range roles {
// 检查是否为已删除
if role.DelFlag == "1" {
return 0, errors.New(role.RoleID + " 角色信息已经删除!")
return 0, errors.New(role.RoleID + " The character information has been deleted")
}
// 检查分配用户
userCount := r.sysUserRoleRepository.CountUserRoleByRoleId(role.RoleID)
if userCount > 0 {
msg := fmt.Sprintf("%s】已分配给用户,不能删除", role.RoleName)
msg := fmt.Sprintf("[%s] has been assigned to a user and cannot be deleted", role.RoleName)
return 0, errors.New(msg)
}
}
@@ -117,7 +117,7 @@ func (r *ServiceSysRole) DeleteRoleByIds(roleIds []string) (int64, error) {
rows := r.sysRoleRepository.DeleteRoleByIds(roleIds)
return rows, nil
}
return 0, errors.New("删除角色信息失败!")
return 0, errors.New("failed to delete role information")
}
// CheckUniqueRoleName 校验角色名称是否唯一