mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-04-02 07:06:37 +08:00
feat: 完善各个模块的权限
This commit is contained in:
@@ -26,5 +26,10 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss
|
|||||||
public string? Cover { get; set; }
|
public string? Cover { get; set; }
|
||||||
|
|
||||||
public int OrderNum { get; set; } = 0;
|
public int OrderNum { get; set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否禁止评论创建功能
|
||||||
|
/// </summary>
|
||||||
|
public bool IsDisableCreateComment { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,10 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss
|
|||||||
{
|
{
|
||||||
public class DiscussGetListOutputDto : EntityDto<Guid>
|
public class DiscussGetListOutputDto : EntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 是否禁止评论创建功能
|
||||||
|
/// </summary>
|
||||||
|
public bool IsDisableCreateComment { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否已点赞,默认未登录不点赞
|
/// 是否已点赞,默认未登录不点赞
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss
|
|||||||
{
|
{
|
||||||
public class DiscussGetOutputDto : EntityDto<Guid>
|
public class DiscussGetOutputDto : EntityDto<Guid>
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 是否禁止评论创建功能
|
||||||
|
/// </summary>
|
||||||
|
public bool IsDisableCreateComment { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string? Types { get; set; }
|
public string? Types { get; set; }
|
||||||
public string? Introduction { get; set; }
|
public string? Introduction { get; set; }
|
||||||
|
|||||||
@@ -22,5 +22,10 @@ namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss
|
|||||||
public string? Cover { get; set; }
|
public string? Cover { get; set; }
|
||||||
|
|
||||||
public int OrderNum { get; set; }
|
public int OrderNum { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否禁止评论创建功能
|
||||||
|
/// </summary>
|
||||||
|
public bool IsDisableCreateComment { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,10 +102,17 @@ namespace Yi.Framework.Bbs.Application.Services
|
|||||||
/// <exception cref="UserFriendlyException"></exception>
|
/// <exception cref="UserFriendlyException"></exception>
|
||||||
public override async Task<CommentGetOutputDto> CreateAsync(CommentCreateInputVo input)
|
public override async Task<CommentGetOutputDto> CreateAsync(CommentCreateInputVo input)
|
||||||
{
|
{
|
||||||
if (!await _discussRepository.IsAnyAsync(x => x.Id == input.DiscussId))
|
var discuess = await _discussRepository.GetFirstAsync(x => x.Id == input.DiscussId);
|
||||||
|
if (discuess is null)
|
||||||
{
|
{
|
||||||
throw new UserFriendlyException(DiscussConst.No_Exist);
|
throw new UserFriendlyException(DiscussConst.No_Exist);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (discuess.IsDisableCreateComment == true)
|
||||||
|
{
|
||||||
|
throw new UserFriendlyException("该主题已禁止评论功能");
|
||||||
|
|
||||||
|
}
|
||||||
var entity = await _forumManager.CreateCommentAsync(input.DiscussId, input.ParentId, input.RootId, input.Content);
|
var entity = await _forumManager.CreateCommentAsync(input.DiscussId, input.ParentId, input.RootId, input.Content);
|
||||||
return await MapToGetOutputDtoAsync(entity);
|
return await MapToGetOutputDtoAsync(entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,5 +59,10 @@ namespace Yi.Framework.Bbs.Domain.Entities
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(IsJson = true)]//使用json处理
|
[SugarColumn(IsJson = true)]//使用json处理
|
||||||
public List<Guid>? PermissionUserIds { get; set; }
|
public List<Guid>? PermissionUserIds { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否禁止评论创建功能
|
||||||
|
/// </summary>
|
||||||
|
public bool IsDisableCreateComment { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user