style: 修改报错信息中文样式

This commit is contained in:
橙子
2023-10-04 23:16:07 +08:00
parent fcb0ea9574
commit c1c0774572
11 changed files with 25 additions and 25 deletions

View File

@@ -63,7 +63,7 @@ namespace Yi.Furion.Application.Bbs.Services.Impl
{
if (!await _discussRepository.IsAnyAsync(x => x.Id == discussId))
{
throw new UserFriendlyException(DiscussConst.);
throw new UserFriendlyException(DiscussConst.No_Exist);
}
var entities = await _articleRepository.GetTreeAsync(x => x.DiscussId == discussId);
@@ -82,11 +82,11 @@ namespace Yi.Furion.Application.Bbs.Services.Impl
var discuss = await _discussRepository.GetFirstAsync(x => x.Id == input.DiscussId);
if (discuss is null)
{
throw new UserFriendlyException(DiscussConst.);
throw new UserFriendlyException(DiscussConst.No_Exist);
}
if (input.ParentId != 0 && !await _repository.IsAnyAsync(x => x.Id == input.ParentId))
{
throw new UserFriendlyException(ArticleConst.);
throw new UserFriendlyException(ArticleConst.No_Exist);
}
await VerifyDiscussCreateIdAsync(discuss.CreatorId);
return await base.CreateAsync(input);

View File

@@ -98,7 +98,7 @@ namespace Yi.Furion.Application.Bbs.Services.Impl
{
if (!await _discussRepository.IsAnyAsync(x => x.Id == input.DiscussId))
{
throw new UserFriendlyException(DiscussConst.);
throw new UserFriendlyException(DiscussConst.No_Exist);
}
var entity = await _forumManager.CreateCommentAsync(input.DiscussId, input.ParentId, input.RootId, input.Content);
return await MapToGetOutputDtoAsync(entity);

View File

@@ -109,7 +109,7 @@ namespace Yi.Furion.Application.Bbs.Services.Impl
{
if (!await _plateEntityRepository.IsAnyAsync(x => x.Id == input.PlateId))
{
throw new UserFriendlyException(PlateConst.);
throw new UserFriendlyException(PlateConst.No_Exist);
}
var entity = await _forumManager.CreateDiscussAsync(await MapToEntityAsync(input));
return await MapToGetOutputDtoAsync(entity);
@@ -129,20 +129,20 @@ namespace Yi.Furion.Application.Bbs.Services.Impl
var discuss = await _repository.GetFirstAsync(x => x.Id == discussId);
if (discuss is null)
{
throw new UserFriendlyException(DiscussConst.);
throw new UserFriendlyException(DiscussConst.No_Exist);
}
if (discuss.PermissionType == DiscussPermissionTypeEnum.Oneself)
{
if (discuss.CreatorId != _currentUser.Id)
{
throw new UserFriendlyException(DiscussConst.);
throw new UserFriendlyException(DiscussConst.Privacy);
}
}
if (discuss.PermissionType == DiscussPermissionTypeEnum.User)
{
if (discuss.CreatorId != _currentUser.Id && !discuss.PermissionUserIds.Contains(_currentUser.Id))
{
throw new UserFriendlyException(DiscussConst.);
throw new UserFriendlyException(DiscussConst.Privacy);
}
}
}

View File

@@ -40,9 +40,9 @@ namespace Yi.Furion.Application.Rbac.Domain
{
return;
}
throw new UserFriendlyException(UserConst._错误);
throw new UserFriendlyException(UserConst.Login_Error);
}
throw new UserFriendlyException(UserConst._不存在);
throw new UserFriendlyException(UserConst.Login_User_No_Exist);
}
/// <summary>

View File

@@ -125,7 +125,7 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
if (userInfo.RoleCodes.Count == 0)
{
throw new UserFriendlyException(UserConst.);
throw new UserFriendlyException(UserConst.No_Role);
}
//这里抛出一个登录的事件
var loginLogEntity = _httpContextAccessor.HttpContext.GetLoginLogInfo();

View File

@@ -85,11 +85,11 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
{
if (string.IsNullOrEmpty(input.Password))
{
throw new UserFriendlyException(UserConst._密码为空);
throw new UserFriendlyException(UserConst.Login_Passworld_Error);
}
if (await _repository.IsAnyAsync(u => input.UserName.Equals(u.UserName)))
{
throw new UserFriendlyException(UserConst._用户存在);
throw new UserFriendlyException(UserConst.User_Exist);
}
var entities = await MapToEntityAsync(input);

View File

@@ -12,8 +12,8 @@ namespace Yi.Furion.Core.Bbs.Consts
public class ArticleConst
{
public const string = "传入的文章id不存在";
public const string No_Exist = "传入的文章id不存在";
public const string = "该文章无权限";
public const string No_Permission = "该文章无权限";
}
}

View File

@@ -12,8 +12,8 @@ namespace Yi.Furion.Core.Bbs.Consts
public class DiscussConst
{
public const string = "传入的主题id不存在";
public const string No_Exist = "传入的主题id不存在";
public const string = "【私密】您无该主题权限,可联系作者申请开放";
public const string Privacy = "【私密】您无该主题权限,可联系作者申请开放";
}
}

View File

@@ -12,6 +12,6 @@ namespace Yi.Furion.Core.Bbs.Consts
public class PlateConst
{
public const string = "传入的板块id不存在";
public const string No_Exist = "传入的板块id不存在";
}
}

View File

@@ -50,7 +50,7 @@ namespace Yi.Furion.Core.Bbs.Dtos.Discuss
public void SetBan()
{
this.Title = DiscussConst.˽<EFBFBD><EFBFBD>;
this.Title = DiscussConst.Privacy;
this.Introduction = "";
this.Cover = null;
//<2F><><EFBFBD><EFBFBD>ֹ

View File

@@ -12,12 +12,12 @@ namespace Yi.Furion.Core.Rbac.Consts
public class UserConst
{
public const string _错误 = "登录失败!用户名或密码错误!";
public const string _不存在 = "登录失败!用户名不存在!";
public const string _密码为空 = "密码为空,添加失败!";
public const string _用户存在 = "用户已经存在,添加失败!";
public const string = "登录禁用!该用户分配无任何权限,无意义登录!";
public const string = "登录禁用!该用户分配无任何角色,无意义登录!";
public const string Login_Error = "登录失败!用户名或密码错误!";
public const string Login_User_No_Exist = "登录失败!用户名不存在!";
public const string Login_Passworld_Error = "密码为空,添加失败!";
public const string User_Exist = "用户已经存在,添加失败!";
public const string No_Permission = "登录禁用!该用户分配无任何权限,无意义登录!";
public const string No_Role = "登录禁用!该用户分配无任何角色,无意义登录!";
public const string Admin = "cc";
public const string AdminRolesCode = "admin";