feat:全基础流程跑通

This commit is contained in:
橙子
2023-04-15 22:44:33 +08:00
parent 9b1a978cb5
commit 1655870d4d
151 changed files with 3120 additions and 209 deletions

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Furion.Core.Bbs.Enums;
namespace Yi.Furion.Core.Bbs.Dtos.Discuss
{
/// <summary>
/// Discuss输入创建对象
/// </summary>
public class DiscussCreateInputVo
{
public string Title { get; set; }
public string Types { get; set; }
public string Introduction { get; set; }
public DateTime? CreateTime { get; set; } = DateTime.Now;
public string Content { get; set; }
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; }
}
}

View File

@@ -0,0 +1,19 @@
using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Furion.Core.Bbs.Enums;
namespace Yi.Furion.Core.Bbs.Dtos.Discuss
{
public class DiscussGetListInputVo : PagedAndSortedResultRequestDto
{
public string Title { get; set; }
public long? PlateId { get; set; }
//默认查询非置顶
public bool IsTop { get; set; } = false;
//查询方式
public QueryDiscussTypeEnum Type { get; set; } = QueryDiscussTypeEnum.New;
}
}

View File

@@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
using Yi.Furion.Core.Bbs.Consts;
using Yi.Furion.Core.Bbs.Enums;
using Yi.Furion.Core.Rbac.Dtos.User;
namespace Yi.Furion.Core.Bbs.Dtos.Discuss
{
public class DiscussGetListOutputDto : IEntityDto<long>
{
/// <summary>
/// 是否已点赞
/// </summary>
public bool IsAgree { get; set; }
public long Id { get; set; }
public string Title { get; set; }
public string Types { get; set; }
public string Introduction { get; set; }
public int AgreeNum { get; set; }
public int SeeNum { get; set; }
//批量查询,不给内容,性能考虑
//public string Content { get; set; }
public string Color { get; set; }
public long PlateId { get; set; }
//是否置顶默认false
public bool IsTop { get; set; }
public DiscussPermissionTypeEnum PermissionType { get; set; }
//是否禁止默认false
public bool IsBan { get; set; }
/// <summary>
/// 封面
/// </summary>
public string Cover { get; set; }
//私有需要判断code权限
public string PrivateCode { get; set; }
public DateTime CreationTime { get; set; }
public List<long> PermissionUserIds { get; set; }
public UserGetListOutputDto User { get; set; }
public void SetBan()
{
Title = DiscussConst.;
Introduction = "";
Cover = null;
//被禁止
IsBan = true;
}
}
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.SetBan();
}
break;
case DiscussPermissionTypeEnum.User:
//当前主题为部分可见,同时不是当前登录用户 也 不在可见用户列表中
if (dto.User.Id != userId && !dto.PermissionUserIds.Contains(userId))
{
dto.SetBan();
}
break;
default:
break;
}
});
}
}
}

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
using Yi.Furion.Core.Bbs.Enums;
using Yi.Furion.Core.Rbac.Dtos.User;
namespace Yi.Furion.Core.Bbs.Dtos.Discuss
{
public class DiscussGetOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public string Title { get; set; }
public string Types { get; set; }
public string Introduction { get; set; }
public int AgreeNum { get; set; }
public int SeeNum { get; set; }
public string Content { get; set; }
public string Color { get; set; }
public long PlateId { get; set; }
//是否置顶默认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 List<long> PermissionUserIds { get; set; }
public UserGetListOutputDto User { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
using System.Collections.Generic;
using Yi.Furion.Core.Bbs.Enums;
namespace Yi.Furion.Core.Bbs.Dtos.Discuss
{
public class DiscussUpdateInputVo
{
public string Title { get; set; }
public string Types { get; set; }
public string Introduction { get; set; }
public int AgreeNum { get; set; }
public int SeeNum { get; set; }
public string Content { get; set; }
public string Color { get; set; }
public List<long> PermissionUserIds { get; set; }
public DiscussPermissionTypeEnum PermissionType { get; set; }
/// <summary>
/// ·âÃæ
/// </summary>
public string Cover { get; set; }
}
}