mirror of
https://gitee.com/ccnetcore/Yi
synced 2026-04-09 02:36:36 +08:00
feat:完成仅自己可见功能
This commit is contained in:
@@ -94,11 +94,36 @@
|
||||
Discuss输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.BBS.Application.Contracts.Forum.Dtos.Discuss.DiscussCreateInputVo.PermissionType">
|
||||
<summary>
|
||||
默认公开
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.BBS.Application.Contracts.Forum.Dtos.Discuss.DiscussCreateInputVo.Cover">
|
||||
<summary>
|
||||
封面
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.BBS.Application.Contracts.Forum.Dtos.Discuss.DiscussGetListOutputDto.IsAgree">
|
||||
<summary>
|
||||
是否已点赞
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.BBS.Application.Contracts.Forum.Dtos.Discuss.DiscussGetListOutputDto.Cover">
|
||||
<summary>
|
||||
封面
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.BBS.Application.Contracts.Forum.Dtos.Discuss.DiscussUpdateInputVo.Cover">
|
||||
<summary>
|
||||
封面
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.BBS.Application.Contracts.Forum.Dtos.DiscussGetOutputDto.Cover">
|
||||
<summary>
|
||||
封面
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.BBS.Application.Contracts.Forum.Dtos.MyTypeCreateInputVo">
|
||||
<summary>
|
||||
Label输入创建对象
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.BBS.Domain.Shared.Forum.EnumClasses;
|
||||
|
||||
namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss
|
||||
{
|
||||
@@ -19,5 +20,14 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss
|
||||
public string? Color { get; set; }
|
||||
|
||||
public long plateId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 默认公开
|
||||
/// </summary>
|
||||
public DiscussPermissionTypeEnum PermissionType { get; set; } = DiscussPermissionTypeEnum.Public;
|
||||
/// <summary>
|
||||
/// 封面
|
||||
/// </summary>
|
||||
public string? Cover { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss
|
||||
//默认查询非置顶
|
||||
public bool IsTop { get; set; } = false;
|
||||
|
||||
|
||||
//查询方式
|
||||
public QueryDiscussTypeEnum Type { get; set; } = QueryDiscussTypeEnum.New;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.BBS.Domain.Shared.Forum.ConstClasses;
|
||||
using Yi.BBS.Domain.Shared.Forum.EnumClasses;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
|
||||
@@ -32,13 +34,58 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss
|
||||
//是否置顶,默认false
|
||||
public bool IsTop { get; set; }
|
||||
|
||||
public DiscussPermissionTypeEnum PermissionType { get; set; }
|
||||
//是否禁止,默认false
|
||||
public bool IsBan { get; set; }
|
||||
|
||||
//是否私有,默认false
|
||||
public bool IsPrivate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 封面
|
||||
/// </summary>
|
||||
public string? Cover { get; set; }
|
||||
|
||||
//私有需要判断code权限
|
||||
public string? PrivateCode { get; set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
|
||||
|
||||
public UserGetListOutputDto User { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public static class DiscussGetListOutputDtoExtension
|
||||
{
|
||||
|
||||
public static void ApplyPermissionTypeFilter(this List<DiscussGetListOutputDto> dtos, long userId)
|
||||
{
|
||||
dtos?.ForEach(dto =>
|
||||
{
|
||||
switch (dto.PermissionType)
|
||||
{
|
||||
case DiscussPermissionTypeEnum.Public:
|
||||
break;
|
||||
case DiscussPermissionTypeEnum.Oneself:
|
||||
//当前主题是仅自己可见,同时不是当前登录用户
|
||||
if (dto.User.Id != userId)
|
||||
{
|
||||
dto.Title = DiscussConst.私密;
|
||||
dto.Introduction= "";
|
||||
dto.Cover = null;
|
||||
//被禁止
|
||||
dto.IsBan = true;
|
||||
}
|
||||
break;
|
||||
case DiscussPermissionTypeEnum.User:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.BBS.Domain.Shared.Forum.EnumClasses;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
|
||||
@@ -25,14 +26,17 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos
|
||||
//是否置顶,默认false
|
||||
public bool IsTop { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 封面
|
||||
/// </summary>
|
||||
public string? Cover { get; set; }
|
||||
//是否私有,默认false
|
||||
public bool IsPrivate { get; set; }
|
||||
|
||||
//私有需要判断code权限
|
||||
public string? PrivateCode { get; set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
public DiscussPermissionTypeEnum PermissionType { get; set; }
|
||||
public UserGetListOutputDto User { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.BBS.Domain.Shared.Forum.EnumClasses;
|
||||
|
||||
namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss
|
||||
{
|
||||
@@ -15,5 +16,13 @@ namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss
|
||||
public int SeeNum { get; set; }
|
||||
public string Content { get; set; }
|
||||
public string? Color { get; set; }
|
||||
|
||||
|
||||
public DiscussPermissionTypeEnum PermissionType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// ·âÃæ
|
||||
/// </summary>
|
||||
public string? Cover { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,6 @@ namespace Yi.BBS.Application.Contracts.Forum
|
||||
/// </summary>
|
||||
public interface IDiscussService : ICrudAppService<DiscussGetOutputDto, DiscussGetListOutputDto, long, DiscussGetListInputVo, DiscussCreateInputVo, DiscussUpdateInputVo>
|
||||
{
|
||||
|
||||
Task VerifyDiscussPermissionAsync(long discussId);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user