chore: 构建稳定版本

This commit is contained in:
陈淳
2023-12-11 09:55:12 +08:00
parent 098d4bc85f
commit 769a6a9c63
756 changed files with 10431 additions and 19867 deletions

View File

@@ -0,0 +1,10 @@
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.AccessLog
{
public class AccessLogDto
{
public Guid Id { get; set; }
public long Number { get; set; }
public DateTime? LastModificationTime { get; set; }
public DateTime CreationTime { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Argee
{
public class AgreeDto
{
public AgreeDto(bool isAgree)
{
IsAgree = isAgree;
if (isAgree)
{
Message = "点赞成功,点赞+1";
}
else
{
Message = "取消点赞,点赞-1";
}
}
public bool IsAgree { get; set; }
public string Message { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article
{
public class ArticleAllOutputDto : EntityDto<Guid>
{
//批量查询,不给内容,性能考虑
//public string Content { get; set; }
public string Name { get; set; }
public Guid DiscussId { get; set; }
public Guid ParentId { get; set; }
public List<ArticleAllOutputDto>? Children { get; set; }
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article
{
/// <summary>
/// Article输入创建对象
/// </summary>
public class ArticleCreateInputVo
{
public string Content { get; set; }
public string Name { get; set; }
public Guid DiscussId { get; set; }
public Guid ParentId { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article
{
public class ArticleGetListInputVo : PagedAndSortedResultRequestDto
{
public string? Content { get; set; }
public string? Name { get; set; }
public Guid? DiscussId { get; set; }
public Guid? ParentId { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article
{
public class ArticleGetListOutputDto : EntityDto<Guid>
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD>
//public string Content { get; set; }
public string Name { get; set; }
public Guid DiscussId { get; set; }
public List<ArticleGetListOutputDto>? Children { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article
{
public class ArticleGetOutputDto : EntityDto<Guid>
{
public string Content { get; set; }
public string Name { get; set; }
public Guid DiscussId { get; set; }
public Guid ParentId { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Article
{
public class ArticleUpdateInputVo
{
public string Content { get; set; }
public string Name { get; set; }
public Guid DiscussId { get; set; }
public Guid ParentId { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Banner
{
/// <summary>
/// Banner输入创建对象
/// </summary>
public class BannerCreateInputVo
{
public string Name { get; set; }
public string? Logo { get; set; }
public string? Color { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Banner
{
public class BannerGetListInputVo : PagedAndSortedResultRequestDto
{
public string? Name { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Banner
{
public class BannerGetListOutputDto : EntityDto<Guid>
{
public string Name { get; set; }
public string? Logo { get; set; }
public string? Color { get; set; }
public DateTime CreationTime { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Banner
{
public class BannerGetOutputDto : EntityDto<Guid>
{
public string Name { get; set; }
public string? Logo { get; set; }
public string? Color { get; set; }
public DateTime CreationTime { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Banner
{
public class BannerUpdateInputVo
{
public string? Name { get; set; }
public string? Logo { get; set; }
public string? Color { get; set; }
}
}

View File

@@ -0,0 +1,29 @@
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Comment
{
/// <summary>
/// Comment输入创建对象
/// </summary>
public class CommentCreateInputVo
{
/// <summary>
/// 评论id
/// </summary>
public string? Content { get; set; }
/// <summary>
/// 主题id
/// </summary>
public Guid DiscussId { get; set; }
/// <summary>
/// 第一层评论id第一层为0
/// </summary>
public Guid RootId { get; set; }
/// <summary>
/// 被回复的CommentId第一层为0
/// </summary>
public Guid ParentId { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Comment
{
public class CommentGetListInputVo
{
public DateTime? creationTime { get; set; }
public string? Content { get; set; }
//Ӧ<><D3A6>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ī<EFBFBD><C4AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ
public Guid? DiscussId { get; set; }
}
}

View File

@@ -0,0 +1,45 @@
using Volo.Abp.Application.Dtos;
using Yi.Framework.Rbac.Application.Contracts.Dtos.User;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Comment
{
/// <summary>
/// <20><><EFBFBD>۶෴
/// </summary>
public class CommentGetListOutputDto : EntityDto<Guid>
{
public DateTime? CreationTime { get; set; }
public string Content { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD>id
/// </summary>
public Guid DiscussId { get; set; }
public Guid ParentId { get; set; }
public Guid RootId { get; set; }
/// <summary>
/// <20>û<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>Ϣ
/// </summary>
public UserGetOutputDto CreateUser { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD>۵<EFBFBD><DBB5>û<EFBFBD><C3BB><EFBFBD>Ϣ
/// </summary>
public UserGetOutputDto CommentedUser { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>Σ<EFBFBD><CEA3><EFBFBD><EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ά<EFBFBD><CEAC><EFBFBD><EFBFBD><E9A3AC>Childrenֻ<6E><D6BB><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>һ<EFBFBD><D2BB>
/// </summary>
public List<CommentGetListOutputDto> Children { get; set; } = new List<CommentGetListOutputDto>();
}
}

View File

@@ -0,0 +1,34 @@
using Volo.Abp.Application.Dtos;
using Yi.Framework.Rbac.Application.Contracts.Dtos.User;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Comment
{
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD><D8A3><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۼ<EFBFBD><DBBC><EFBFBD>
/// </summary>
public class CommentGetOutputDto : EntityDto<Guid>
{
public DateTime? CreateTime { get; set; }
public string Content { get; set; }
public Guid DiscussId { get; set; }
/// <summary>
/// <20>û<EFBFBD>id<69><64><EFBFBD><EFBFBD>Ϊ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
public UserGetOutputDto User { get; set; }
/// <summary>
/// <20><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>id
/// </summary>
public Guid RootId { get; set; }
/// <summary>
/// <20><><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>CommentId
/// </summary>
public Guid ParentId { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Comment
{
public class CommentUpdateInputVo
{
public string Content { get; set; }
//<2F><><EFBFBD>²<EFBFBD><C2B2>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
}
}

View File

@@ -0,0 +1,28 @@
using Yi.Framework.Bbs.Domain.Shared.Enums;
namespace Yi.Framework.Bbs.Application.Contracts.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 Guid 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 Volo.Abp.Application.Dtos;
using Yi.Framework.Bbs.Domain.Shared.Enums;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss
{
public class DiscussGetListInputVo : PagedAndSortedResultRequestDto
{
public string Title { get; set; }
public Guid? PlateId { get; set; }
//Ĭ<>ϲ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD>ö<EFBFBD>
public bool IsTop { get; set; } = false;
//<2F><>ѯ<EFBFBD><D1AF>ʽ
public QueryDiscussTypeEnum Type { get; set; } = QueryDiscussTypeEnum.New;
}
}

View File

@@ -0,0 +1,92 @@
using Volo.Abp.Application.Dtos;
using Yi.Framework.Bbs.Domain.Shared.Consts;
using Yi.Framework.Bbs.Domain.Shared.Enums;
using Yi.Framework.Rbac.Application.Contracts.Dtos.User;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss
{
public class DiscussGetListOutputDto : EntityDto<Guid>
{
/// <summary>
/// <20>Ƿ<EFBFBD><C7B7>ѵ<EFBFBD><D1B5><EFBFBD>
/// </summary>
public bool IsAgree { 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; }
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD>
//public string Content { get; set; }
public string? Color { get; set; }
public Guid PlateId { get; set; }
//<2F>Ƿ<EFBFBD><C7B7>ö<EFBFBD><C3B6><EFBFBD>Ĭ<EFBFBD><C4AC>false
public bool IsTop { get; set; }
public DiscussPermissionTypeEnum PermissionType { get; set; }
//<2F>Ƿ<EFBFBD><C7B7><EFBFBD>ֹ<EFBFBD><D6B9>Ĭ<EFBFBD><C4AC>false
public bool IsBan { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD>
/// </summary>
public string? Cover { get; set; }
//˽<><CBBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ж<EFBFBD>codeȨ<65><C8A8>
public string? PrivateCode { get; set; }
public DateTime CreationTime { get; set; }
public List<Guid>? PermissionUserIds { get; set; }
public UserGetListOutputDto User { get; set; }
public void SetBan()
{
Title = DiscussConst.Privacy;
Introduction = "";
Cover = null;
//<2F><><EFBFBD><EFBFBD>ֹ
IsBan = true;
}
}
public static class DiscussGetListOutputDtoExtension
{
public static void ApplyPermissionTypeFilter(this List<DiscussGetListOutputDto> dtos, Guid userId)
{
dtos?.ForEach(dto =>
{
switch (dto.PermissionType)
{
case DiscussPermissionTypeEnum.Public:
break;
case DiscussPermissionTypeEnum.Oneself:
//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD><EFBFBD>ǽ<EFBFBD><C7BD>Լ<EFBFBD><D4BC>ɼ<EFBFBD><C9BC><EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD>ǵ<EFBFBD>ǰ<EFBFBD><C7B0>¼<EFBFBD>û<EFBFBD>
if (dto.User.Id != userId)
{
dto.SetBan();
}
break;
case DiscussPermissionTypeEnum.User:
//<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ֿɼ<D6BF><C9BC><EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD>ǵ<EFBFBD>ǰ<EFBFBD><C7B0>¼<EFBFBD>û<EFBFBD> Ҳ <20><><EFBFBD>ڿɼ<DABF><C9BC>û<EFBFBD><C3BB>б<EFBFBD><D0B1><EFBFBD>
if (dto.User.Id != userId && !dto.PermissionUserIds.Contains(userId))
{
dto.SetBan();
}
break;
default:
break;
}
});
}
}
}

View File

@@ -0,0 +1,36 @@
using Volo.Abp.Application.Dtos;
using Yi.Framework.Bbs.Domain.Shared.Enums;
using Yi.Framework.Rbac.Application.Contracts.Dtos.User;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss
{
public class DiscussGetOutputDto : EntityDto<Guid>
{
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 Guid PlateId { get; set; }
//<2F>Ƿ<EFBFBD><C7B7>ö<EFBFBD><C3B6><EFBFBD>Ĭ<EFBFBD><C4AC>false
public bool IsTop { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD>
/// </summary>
public string? Cover { get; set; }
//<2F>Ƿ<EFBFBD>˽<EFBFBD>У<EFBFBD>Ĭ<EFBFBD><C4AC>false
public bool IsPrivate { get; set; }
//˽<><CBBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ж<EFBFBD>codeȨ<65><C8A8>
public string? PrivateCode { get; set; }
public DateTime CreationTime { get; set; }
public DiscussPermissionTypeEnum PermissionType { get; set; }
public List<Guid>? PermissionUserIds { get; set; }
public UserGetListOutputDto User { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
using Yi.Framework.Bbs.Domain.Shared.Enums;
namespace Yi.Framework.Bbs.Application.Contracts.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<Guid> PermissionUserIds { get; set; }
public DiscussPermissionTypeEnum PermissionType { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD>
/// </summary>
public string? Cover { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.MyType
{
/// <summary>
/// Label输入创建对象
/// </summary>
public class MyTypeCreateInputVo
{
public string Name { get; set; }
public string? Color { get; set; }
public string? BackgroundColor { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.MyType
{
public class MyTypeGetListInputVo : PagedAndSortedResultRequestDto
{
public string? Name { get; set; }
public string? Color { get; set; }
public string? BackgroundColor { get; set; }
public Guid? UserId { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.MyType
{
public class MyTypeGetListOutputDto : EntityDto<Guid>
{
public string Name { get; set; }
public string? Color { get; set; }
public string? BackgroundColor { get; set; }
public Guid UserId { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.MyType
{
public class MyTypeOutputDto : EntityDto<Guid>
{
public string Name { get; set; }
public string? Color { get; set; }
public string? BackgroundColor { get; set; }
public Guid UserId { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.MyType
{
public class MyTypeUpdateInputVo
{
public string Name { get; set; }
public string? Color { get; set; }
public string? BackgroundColor { get; set; }
public Guid UserId { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate
{
/// <summary>
/// Plate输入创建对象
/// </summary>
public class PlateCreateInputVo
{
public string Name { get; set; }
public string? Logo { get; set; }
public string? Introduction { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate
{
public class PlateGetListInputVo : PagedAndSortedResultRequestDto
{
public string? Name { get; set; }
public string? Logo { get; set; }
public string? Introduction { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate
{
public class PlateGetListOutputDto : EntityDto<Guid>
{
public string Name { get; set; }
public string? Logo { get; set; }
public string? Introduction { get; set; }
}
}

View File

@@ -0,0 +1,11 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate
{
public class PlateGetOutputDto : EntityDto<Guid>
{
public string Name { get; set; }
public string? Logo { get; set; }
public string? Introduction { get; set; }
}
}

View File

@@ -0,0 +1,9 @@
namespace Yi.Framework.Bbs.Application.Contracts.Dtos.Plate
{
public class PlateUpdateInputVo
{
public string? Name { get; set; }
public string? Logo { get; set; }
public string? Introduction { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Bbs.Application.Contracts.IServices
{
public interface IAccessLogService
{
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Bbs.Application.Contracts.Dtos.Article;
using Yi.Framework.Ddd.Application.Contracts;
namespace Yi.Framework.Bbs.Application.Contracts.IServices
{
/// <summary>
/// Article服务抽象
/// </summary>
public interface IArticleService : IYiCrudAppService<ArticleGetOutputDto, ArticleGetListOutputDto, Guid, ArticleGetListInputVo, ArticleCreateInputVo, ArticleUpdateInputVo>
{
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Bbs.Application.Contracts.Dtos.Banner;
using Yi.Framework.Ddd.Application.Contracts;
namespace Yi.Framework.Bbs.Application.Contracts.IServices
{
/// <summary>
/// Banner抽象
/// </summary>
public interface IBannerService : IYiCrudAppService<BannerGetOutputDto, BannerGetListOutputDto, Guid, BannerGetListInputVo, BannerCreateInputVo, BannerUpdateInputVo>
{
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Bbs.Application.Contracts.Dtos.Comment;
using Yi.Framework.Ddd.Application.Contracts;
namespace Yi.Framework.Bbs.Application.Contracts.IServices
{
/// <summary>
/// Comment服务抽象
/// </summary>
public interface ICommentService : IYiCrudAppService<CommentGetOutputDto, CommentGetListOutputDto, Guid, CommentGetListInputVo, CommentCreateInputVo, CommentUpdateInputVo>
{
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss;
using Yi.Framework.Ddd.Application.Contracts;
namespace Yi.Framework.Bbs.Application.Contracts.IServices
{
/// <summary>
/// Discuss服务抽象
/// </summary>
public interface IDiscussService : IYiCrudAppService<DiscussGetOutputDto, DiscussGetListOutputDto, Guid, DiscussGetListInputVo, DiscussCreateInputVo, DiscussUpdateInputVo>
{
Task VerifyDiscussPermissionAsync(Guid discussId);
}
}

View File

@@ -0,0 +1,12 @@
using Yi.Framework.Bbs.Application.Contracts.Dtos.MyType;
using Yi.Framework.Ddd.Application.Contracts;
namespace Yi.Framework.Bbs.Application.Contracts.IServices
{
/// <summary>
/// Label服务抽象
/// </summary>
public interface IMyTypeService : IYiCrudAppService<MyTypeOutputDto, MyTypeGetListOutputDto, Guid, MyTypeGetListInputVo, MyTypeCreateInputVo, MyTypeUpdateInputVo>
{
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Bbs.Application.Contracts.Dtos.Plate;
using Yi.Framework.Ddd.Application.Contracts;
namespace Yi.Framework.Bbs.Application.Contracts.IServices
{
/// <summary>
/// Plate服务抽象
/// </summary>
public interface IPlateService : IYiCrudAppService<PlateGetOutputDto, PlateGetListOutputDto, Guid, PlateGetListInputVo, PlateCreateInputVo, PlateUpdateInputVo>
{
}
}

View File

@@ -0,0 +1,16 @@
using Volo.Abp.Application.Services;
namespace Yi.Framework.Bbs.Application.Contracts.IServices
{
/// <summary>
/// Setting应用抽象
/// </summary>
public interface ISettingService : IApplicationService
{
/// <summary>
/// 获取配置标题
/// </summary>
/// <returns></returns>
Task<string> GetTitleAsync();
}
}

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\rbac\Yi.Framework.Rbac.Application.Contracts\Yi.Framework.Rbac.Application.Contracts.csproj" />
<ProjectReference Include="..\Yi.Framework.Bbs.Domain.Shared\Yi.Framework.Bbs.Domain.Shared.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,174 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.Framework.Bbs.Application.Contracts</name>
</assembly>
<members>
<member name="T:Yi.Framework.Bbs.Application.Contracts.Dtos.Article.ArticleCreateInputVo">
<summary>
Article输入创建对象
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Application.Contracts.Dtos.Banner.BannerCreateInputVo">
<summary>
Banner输入创建对象
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Application.Contracts.Dtos.Comment.CommentCreateInputVo">
<summary>
Comment输入创建对象
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Comment.CommentCreateInputVo.Content">
<summary>
评论id
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Comment.CommentCreateInputVo.DiscussId">
<summary>
主题id
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Comment.CommentCreateInputVo.RootId">
<summary>
第一层评论id第一层为0
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Comment.CommentCreateInputVo.ParentId">
<summary>
被回复的CommentId第一层为0
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Application.Contracts.Dtos.Comment.CommentGetListOutputDto">
<summary>
评论多反
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Comment.CommentGetListOutputDto.DiscussId">
<summary>
主题id
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Comment.CommentGetListOutputDto.CreateUser">
<summary>
用户,评论人用户信息
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Comment.CommentGetListOutputDto.CommentedUser">
<summary>
被评论的用户信息
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Comment.CommentGetListOutputDto.Children">
<summary>
这个不是一个树形而是存在一个二维数组该Children只有在顶级时候只有一层
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Application.Contracts.Dtos.Comment.CommentGetOutputDto">
<summary>
单返回,返回单条评论即可
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Comment.CommentGetOutputDto.User">
<summary>
用户id联表为用户对象
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Comment.CommentGetOutputDto.RootId">
<summary>
根节点的评论id
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Comment.CommentGetOutputDto.ParentId">
<summary>
被回复的CommentId
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss.DiscussCreateInputVo">
<summary>
Discuss输入创建对象
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss.DiscussCreateInputVo.PermissionType">
<summary>
默认公开
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss.DiscussCreateInputVo.Cover">
<summary>
封面
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss.DiscussGetListOutputDto.IsAgree">
<summary>
是否已点赞
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss.DiscussGetListOutputDto.Cover">
<summary>
封面
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss.DiscussGetOutputDto.Cover">
<summary>
封面
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss.DiscussUpdateInputVo.Cover">
<summary>
封面
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Application.Contracts.Dtos.MyType.MyTypeCreateInputVo">
<summary>
Label输入创建对象
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Application.Contracts.Dtos.Plate.PlateCreateInputVo">
<summary>
Plate输入创建对象
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Application.Contracts.IServices.IArticleService">
<summary>
Article服务抽象
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Application.Contracts.IServices.IBannerService">
<summary>
Banner抽象
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Application.Contracts.IServices.ICommentService">
<summary>
Comment服务抽象
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Application.Contracts.IServices.IDiscussService">
<summary>
Discuss服务抽象
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Application.Contracts.IServices.IMyTypeService">
<summary>
Label服务抽象
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Application.Contracts.IServices.IPlateService">
<summary>
Plate服务抽象
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Application.Contracts.IServices.ISettingService">
<summary>
Setting应用抽象
</summary>
</member>
<member name="M:Yi.Framework.Bbs.Application.Contracts.IServices.ISettingService.GetTitleAsync">
<summary>
获取配置标题
</summary>
<returns></returns>
</member>
</members>
</doc>

View File

@@ -0,0 +1,15 @@
using Volo.Abp.Modularity;
using Yi.Framework.Bbs.Domain.Shared;
using Yi.Framework.Rbac.Application.Contracts;
namespace Yi.Framework.Bbs.Application.Contracts
{
[DependsOn(typeof(YiFrameworkBbsDomainSharedModule),
typeof(YiFrameworkRbacApplicationContractsModule)
)]
public class YiFrameworkBbsApplicationContractsModule : AbpModule
{
}
}

View File

@@ -0,0 +1,110 @@
using Mapster;
using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Services;
using Yi.Framework.Bbs.Application.Contracts.Dtos.AccessLog;
using Yi.Framework.Bbs.Application.Contracts.IServices;
using Yi.Framework.Bbs.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Bbs.Application.Services
{
public class AccessLogService : ApplicationService, IAccessLogService
{
private readonly ISqlSugarRepository<AccessLogEntity> _repository;
public AccessLogService(ISqlSugarRepository<AccessLogEntity> repository) { _repository = repository; }
public DateTime GetWeekFirst()
{
var week = DateTime.Now.DayOfWeek;
switch (week)
{
case DayOfWeek.Sunday:
return DateTime.Now.AddDays(-6).Date;
case DayOfWeek.Monday:
return DateTime.Now.AddDays(-0).Date;
case DayOfWeek.Tuesday:
return DateTime.Now.AddDays(-1).Date;
case DayOfWeek.Wednesday:
return DateTime.Now.AddDays(-2).Date;
case DayOfWeek.Thursday:
return DateTime.Now.AddDays(-3).Date;
case DayOfWeek.Friday:
return DateTime.Now.AddDays(-4).Date;
case DayOfWeek.Saturday:
return DateTime.Now.AddDays(-5).Date;
default:
throw new ArgumentException("日期错误");
}
}
/// <summary>
/// 触发
/// </summary>
/// <returns></returns>
[HttpPost("")]
public async Task AccessAsync()
{
//可判断http重复防止同一ip多次访问
var last = await _repository._DbQueryable.OrderByDescending(x => x.CreationTime).FirstAsync();
if (last is null || last.CreationTime.Date != DateTime.Today)
{
await _repository.InsertAsync(new AccessLogEntity());
}
else
{
await _repository._Db.Updateable<AccessLogEntity>().SetColumns(it => it.Number == it.Number + 1).Where(it => it.Id == last.Id).ExecuteCommandAsync();
}
}
/// <summary>
/// 获取当前周数据
/// </summary>
/// <returns></returns>
public async Task<AccessLogDto[]> GetWeekAsync()
{
var lastSeven = await _repository._DbQueryable.OrderByDescending(x => x.CreationTime).ToPageListAsync(1, 7);
return WeekTimeHandler(lastSeven.ToArray());
}
private AccessLogDto[] WeekTimeHandler(AccessLogEntity[] data)
{
data = data.Where(x => x.CreationTime >= GetWeekFirst()).OrderByDescending(x => x.CreationTime).DistinctBy(x => x.CreationTime.DayOfWeek).ToArray();
Dictionary<DayOfWeek, AccessLogDto> processedData = new Dictionary<DayOfWeek, AccessLogDto>();
// 初始化字典将每天的数据都设为0
foreach (DayOfWeek dayOfWeek in Enum.GetValues(typeof(DayOfWeek)))
{
processedData.Add(dayOfWeek, new AccessLogDto());
}
// 处理原始数据
foreach (var item in data)
{
DayOfWeek dayOfWeek = item.CreationTime.DayOfWeek;
// 如果当天有数据则更新字典中的值为对应的Number
var sss = data.Adapt<AccessLogDto>();
processedData[dayOfWeek] = item.Adapt<AccessLogDto>();
}
var result = processedData.Values.ToList();
//此时的时间是周日-周一-周二,需要处理
var first = result[0]; // 获取第一个元素
result.RemoveAt(0); // 移除第一个元素
result.Add(first); // 将第一个元素添加到末尾
return result.ToArray();
}
}
}

View File

@@ -0,0 +1,68 @@
using Volo.Abp;
using Volo.Abp.Application.Services;
using Volo.Abp.Uow;
using Yi.Framework.Bbs.Application.Contracts.Dtos.Argee;
using Yi.Framework.Bbs.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Bbs.Application.Services
{
/// <summary>
/// 点赞功能
/// </summary>
public class AgreeService : ApplicationService, IApplicationService
{
public AgreeService(ISqlSugarRepository<AgreeEntity> repository, ISqlSugarRepository<DiscussEntity> discssRepository)
{
_repository = repository;
_discssRepository = discssRepository;
}
private ISqlSugarRepository<AgreeEntity> _repository { get; set; }
private ISqlSugarRepository<DiscussEntity> _discssRepository { get; set; }
/// <summary>
/// 点赞,返回true为点赞+1返回false为点赞-1
/// </summary>
/// <returns></returns>
[UnitOfWork]
public async Task<AgreeDto> PostOperateAsync(Guid discussId)
{
var entity = await _repository.GetFirstAsync(x => x.DiscussId == discussId && x.CreatorId == this.CurrentUser.Id);
//判断是否已经点赞过
if (entity is null)
{
//没点赞过,添加记录即可,,修改总点赞数量
await _repository.InsertAsync(new AgreeEntity(discussId));
var discussEntity = await _discssRepository.GetByIdAsync(discussId);
if (discussEntity is null)
{
throw new UserFriendlyException("主题为空");
}
discussEntity.AgreeNum += 1;
await _discssRepository.UpdateAsync(discussEntity);
return new AgreeDto(true);
}
else
{
//点赞过,删除即可,修改总点赞数量
await _repository.DeleteByIdAsync(entity.Id);
var discussEntity = await _discssRepository.GetByIdAsync(discussId);
if (discussEntity is null)
{
throw new UserFriendlyException("主题为空");
}
discussEntity.AgreeNum -= 1;
await _discssRepository.UpdateAsync(discussEntity);
return new AgreeDto(false);
}
}
}
}

View File

@@ -0,0 +1,115 @@
using System.Collections.Generic;
using Mapster;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp;
using Yi.Framework.Bbs.Application.Contracts.Dtos.Article;
using Yi.Framework.Bbs.Application.Contracts.IServices;
using Yi.Framework.Bbs.Domain.Entities;
using Yi.Framework.Bbs.Domain.Repositories;
using Yi.Framework.Bbs.Domain.Shared.Consts;
using Yi.Framework.Core.Extensions;
using Yi.Framework.Ddd.Application;
using Yi.Framework.Rbac.Domain.Shared.Consts;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Bbs.Application.Services
{
/// <summary>
/// Article服务实现
/// </summary>
public class ArticleService : YiCrudAppService<ArticleEntity, ArticleGetOutputDto, ArticleGetListOutputDto, Guid, ArticleGetListInputVo, ArticleCreateInputVo, ArticleUpdateInputVo>,
IArticleService
{
public ArticleService(IArticleRepository articleRepository,
ISqlSugarRepository<DiscussEntity> discussRepository,
IDiscussService discussService) : base(articleRepository)
{
_articleRepository = articleRepository;
_discussRepository = discussRepository;
_discussService = discussService;
}
private IArticleRepository _articleRepository { get; set; }
private ISqlSugarRepository<DiscussEntity> _discussRepository { get; set; }
private IDiscussService _discussService { get; set; }
/// <summary>
/// 获取文章全部平铺信息
/// </summary>
/// <param name="discussId"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[Route("article/all/discuss-id/{discussId}")]
public async Task<List<ArticleAllOutputDto>> GetAllAsync([FromRoute] Guid discussId)
{
await _discussService.VerifyDiscussPermissionAsync(discussId);
var entities = await _articleRepository.GetTreeAsync(x => x.DiscussId == discussId);
//var result = entities.Tile();
var items = entities.Adapt<List<ArticleAllOutputDto>>();
return items;
}
/// <summary>
/// 查询文章
/// </summary>
/// <param name="discussId"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
public async Task<List<ArticleGetListOutputDto>> GetDiscussIdAsync([FromRoute] Guid discussId)
{
if (!await _discussRepository.IsAnyAsync(x => x.Id == discussId))
{
throw new UserFriendlyException(DiscussConst.No_Exist);
}
var entities = await _articleRepository.GetTreeAsync(x => x.DiscussId == discussId);
var items = await MapToGetListOutputDtosAsync(entities);
return items;
}
/// <summary>
/// 发表文章
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
public async override Task<ArticleGetOutputDto> CreateAsync(ArticleCreateInputVo input)
{
var discuss = await _discussRepository.GetFirstAsync(x => x.Id == input.DiscussId);
if (discuss is null)
{
throw new UserFriendlyException(DiscussConst.No_Exist);
}
if (input.ParentId != Guid.Empty && !await _articleRepository.IsAnyAsync(x => x.Id == input.ParentId))
{
throw new UserFriendlyException(ArticleConst.No_Exist);
}
await VerifyDiscussCreateIdAsync(discuss.CreatorId);
return await base.CreateAsync(input);
}
/// <summary>
/// 效验创建权限
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public async Task VerifyDiscussCreateIdAsync(Guid? userId)
{
//只有文章是特殊的,不能在其他主题下创建
//主题的创建者不是当前用户,同时,没有权限或者超级管理
//false & true & false ,三个条件任意满意一个,即可成功使用||,最后取反,一个都不满足
//
if (userId != CurrentUser.Id && !UserConst.Admin.Equals(this.CurrentUser.UserName) && this.LazyServiceProvider.GetRequiredService<IHttpContextAccessor>().HttpContext.GetUserPermissions(TokenTypeConst.Permission).Contains("bbs:discuss:add"))
{
throw new UserFriendlyException("无权限在其他用户主题中创建子文章");
}
}
}
}

View File

@@ -0,0 +1,19 @@
using Volo.Abp.Domain.Repositories;
using Yi.Framework.Bbs.Application.Contracts.Dtos.Banner;
using Yi.Framework.Bbs.Application.Contracts.IServices;
using Yi.Framework.Bbs.Domain.Entities;
using Yi.Framework.Ddd.Application;
namespace Yi.Framework.Bbs.Application.Services
{
/// <summary>
/// Banner服务实现
/// </summary>
public class BannerService : YiCrudAppService<BannerEntity, BannerGetOutputDto, BannerGetListOutputDto, Guid, BannerGetListInputVo, BannerCreateInputVo, BannerUpdateInputVo>,
IBannerService
{
public BannerService(IRepository<BannerEntity, Guid> repository) : base(repository)
{
}
}
}

View File

@@ -0,0 +1,107 @@
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Yi.Framework.Bbs.Application.Contracts.Dtos.Comment;
using Yi.Framework.Bbs.Application.Contracts.IServices;
using Yi.Framework.Bbs.Domain.Entities;
using Yi.Framework.Bbs.Domain.Managers;
using Yi.Framework.Bbs.Domain.Shared.Consts;
using Yi.Framework.Ddd.Application;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Bbs.Application.Services
{
/// <summary>
/// 评论
/// </summary>
public class CommentService : YiCrudAppService<CommentEntity, CommentGetOutputDto, CommentGetListOutputDto, Guid, CommentGetListInputVo, CommentCreateInputVo, CommentUpdateInputVo>,
ICommentService
{
private readonly ISqlSugarRepository<CommentEntity, Guid> _repository;
public CommentService(ForumManager forumManager, ISqlSugarRepository<DiscussEntity> discussRepository, IDiscussService discussService, ISqlSugarRepository<CommentEntity,Guid> CommentRepository) :base(CommentRepository)
{
_forumManager = forumManager;
_discussRepository = discussRepository;
_discussService = discussService;
_repository = CommentRepository;
}
private ForumManager _forumManager { get; set; }
private ISqlSugarRepository<DiscussEntity> _discussRepository { get; set; }
private IDiscussService _discussService { get; set; }
/// <summary>
/// 获取改主题下的评论,结构为二维列表,该查询无分页
/// </summary>
/// <param name="discussId"></param>
/// <param name="input"></param>
/// <returns></returns>
public async Task<PagedResultDto<CommentGetListOutputDto>> GetDiscussIdAsync([FromRoute] Guid discussId, [FromQuery] CommentGetListInputVo input)
{
await _discussService.VerifyDiscussPermissionAsync(discussId);
var entities = await _repository._DbQueryable.WhereIF(!string.IsNullOrEmpty(input.Content), x => x.Content.Contains(input.Content))
.Where(x => x.DiscussId == discussId)
.Includes(x => x.CreateUser)
.ToListAsync();
//结果初始值,第一层等于全部根节点
var outPut = entities.Where(x => x.ParentId ==Guid.Empty).OrderByDescending(x => x.CreationTime).ToList();
//将全部数据进行hash
var dic = entities.ToDictionary(x => x.Id);
foreach (var comment in entities)
{
//不是根节点,需要赋值 被评论者用户信息等
if (comment.ParentId != Guid.Empty)
{
var parentComment = dic[comment.ParentId];
comment.CommentedUser = parentComment.CreateUser;
}
//root或者parent id根节点都是等于0的
var id = comment.RootId;
if (id != Guid.Empty)
{
dic[id].Children.Add(comment);
}
}
//子类需要排序
outPut.ForEach(x =>
{
x.Children = x.Children.OrderByDescending(x => x.CreationTime).ToList();
});
//获取全量主题评论, 先获取顶级的,将其他子组合到顶级下,形成一个二维,先转成dto
List<CommentGetListOutputDto> items = await MapToGetListOutputDtosAsync(outPut);
return new PagedResultDto<CommentGetListOutputDto>(entities.Count(), items);
}
/// <summary>
/// 发表评论
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
public override async Task<CommentGetOutputDto> CreateAsync(CommentCreateInputVo input)
{
if (!await _discussRepository.IsAnyAsync(x => x.Id == input.DiscussId))
{
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

@@ -0,0 +1,148 @@
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
using Volo.Abp.EventBus.Local;
using Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss;
using Yi.Framework.Bbs.Application.Contracts.IServices;
using Yi.Framework.Bbs.Domain.Entities;
using Yi.Framework.Bbs.Domain.Managers;
using Yi.Framework.Bbs.Domain.Shared.Consts;
using Yi.Framework.Bbs.Domain.Shared.Enums;
using Yi.Framework.Ddd.Application;
using Yi.Framework.Rbac.Application.Contracts.Dtos.User;
using Yi.Framework.Rbac.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Bbs.Application.Services
{
/// <summary>
/// Discuss应用服务实现,用于参数效验、领域服务业务组合、日志记录、事务处理、账户信息
/// </summary>
public class DiscussService : YiCrudAppService<DiscussEntity, DiscussGetOutputDto, DiscussGetListOutputDto, Guid, DiscussGetListInputVo, DiscussCreateInputVo, DiscussUpdateInputVo>,
IDiscussService
{
public DiscussService(ForumManager forumManager, ISqlSugarRepository<PlateEntity> plateEntityRepository, ILocalEventBus localEventBus) : base(forumManager._discussRepository)
{
_forumManager = forumManager;
_plateEntityRepository = plateEntityRepository;
_localEventBus = localEventBus;
}
private readonly ILocalEventBus _localEventBus;
private ForumManager _forumManager { get; set; }
private ISqlSugarRepository<PlateEntity> _plateEntityRepository { get; set; }
/// <summary>
/// 单查
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async override Task<DiscussGetOutputDto> GetAsync(Guid id)
{
//查询主题发布 浏览主题 事件,浏览数+1
var item = await _forumManager._discussRepository._DbQueryable.LeftJoin<UserEntity>((discuss, user) => discuss.CreatorId == user.Id)
.Select((discuss, user) => new DiscussGetOutputDto
{
User = new UserGetListOutputDto() { UserName = user.UserName, Nick = user.Nick, Icon = user.Icon }
}, true).SingleAsync(discuss => discuss.Id == id);
if (item is not null)
{
await VerifyDiscussPermissionAsync(item.Id);
throw new NotImplementedException("等待更新消息通知");
//_eventPublisher.PublishAsync(new SeeDiscussEventSource(new SeeDiscussEventArgs { DiscussId = item.Id, OldSeeNum = item.SeeNum }));
}
return item;
}
/// <summary>
/// 查询
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public override async Task<PagedResultDto<DiscussGetListOutputDto>> GetListAsync([FromQuery] DiscussGetListInputVo input)
{
//需要关联创建者用户
RefAsync<int> total = 0;
var items = await _forumManager._discussRepository._DbQueryable
.WhereIF(!string.IsNullOrEmpty(input.Title), x => x.Title.Contains(input.Title))
.WhereIF(input.PlateId is not null, x => x.PlateId == input.PlateId)
.Where(x => x.IsTop == input.IsTop)
.LeftJoin<UserEntity>((discuss, user) => discuss.CreatorId == user.Id)
.OrderByIF(input.Type == QueryDiscussTypeEnum.New, discuss => discuss.CreationTime, OrderByType.Desc)
.OrderByIF(input.Type == QueryDiscussTypeEnum.Host, discuss => discuss.SeeNum, OrderByType.Desc)
.OrderByIF(input.Type == QueryDiscussTypeEnum.Suggest, discuss => discuss.AgreeNum, OrderByType.Desc)
.Select((discuss, user) => new DiscussGetListOutputDto
{
Id = discuss.Id,
IsAgree = SqlFunc.Subqueryable<AgreeEntity>().Where(x => x.CreatorId == CurrentUser.Id && x.DiscussId == discuss.Id).Any(),
User = new UserGetListOutputDto() { Id = user.Id, UserName = user.UserName, Nick = user.Nick, Icon = user.Icon }
}, true)
.ToPageListAsync(input.SkipCount, input.MaxResultCount, total);
//查询完主题之后,要过滤一下私有的主题信息
items.ApplyPermissionTypeFilter(CurrentUser.Id ?? Guid.Empty);
return new PagedResultDto<DiscussGetListOutputDto>(total, items);
}
/// <summary>
/// 创建主题
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public override async Task<DiscussGetOutputDto> CreateAsync(DiscussCreateInputVo input)
{
if (!await _plateEntityRepository.IsAnyAsync(x => x.Id == input.PlateId))
{
throw new UserFriendlyException(PlateConst.No_Exist);
}
var entity = await _forumManager.CreateDiscussAsync(await MapToEntityAsync(input));
return await MapToGetOutputDtoAsync(entity);
}
/// <summary>
/// 效验主题查询权限
/// </summary>
/// <param name="discussId"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
public async Task VerifyDiscussPermissionAsync(Guid discussId)
{
var discuss = await _forumManager._discussRepository.GetFirstAsync(x => x.Id == discussId);
if (discuss is null)
{
throw new UserFriendlyException(DiscussConst.No_Exist);
}
if (discuss.PermissionType == DiscussPermissionTypeEnum.Oneself)
{
if (discuss.CreatorId != CurrentUser.Id)
{
throw new UserFriendlyException(DiscussConst.Privacy);
}
}
if (discuss.PermissionType == DiscussPermissionTypeEnum.User)
{
if (discuss.CreatorId != CurrentUser.Id && !discuss.PermissionUserIds.Contains(CurrentUser.Id ?? Guid.Empty))
{
throw new UserFriendlyException(DiscussConst.Privacy);
}
}
}
}
}

View File

@@ -0,0 +1,54 @@
using Volo.Abp.Application.Dtos;
using Volo.Abp.Data;
using Yi.Framework.Bbs.Application.Contracts.Dtos.MyType;
using Yi.Framework.Bbs.Application.Contracts.IServices;
using Yi.Framework.Bbs.Domain.Entities;
using Yi.Framework.Ddd.Application;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Bbs.Application.Services
{
/// <summary>
/// Label服务实现
/// </summary>
public class MyTypeService : YiCrudAppService<MyTypeEntity, MyTypeOutputDto, MyTypeGetListOutputDto, Guid, MyTypeGetListInputVo, MyTypeCreateInputVo, MyTypeUpdateInputVo>,
IMyTypeService
{
private ISqlSugarRepository<MyTypeEntity, Guid> _repository;
public MyTypeService(ISqlSugarRepository<MyTypeEntity,Guid> repository, IDataFilter dataFilter):base(repository)
{
_repository= repository;
_dataFilter = dataFilter;
}
private IDataFilter _dataFilter { get; set; }
/// <summary>
/// 获取当前用户的主题类型
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public Task<PagedResultDto<MyTypeGetListOutputDto>> GetListCurrentAsync(MyTypeGetListInputVo input)
{
//过滤器需要更换
//_dataFilter.Enable<MyTypeEntity>(x => x.UserId == CurrentUser.Id);
//_dataFilter.AddFilter<MyTypeEntity>(x => x.UserId == CurrentUser.Id);
return base.GetListAsync(input);
}
/// <summary>
/// 创建
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public override async Task<MyTypeOutputDto> CreateAsync(MyTypeCreateInputVo input)
{
var entity = await MapToEntityAsync(input);
entity.UserId = CurrentUser.Id??Guid.Empty;
entity.IsDeleted = false;
var outputEntity = await _repository.InsertReturnEntityAsync(entity);
return await MapToGetOutputDtoAsync(outputEntity);
}
}
}

View File

@@ -0,0 +1,19 @@
using Volo.Abp.Domain.Repositories;
using Yi.Framework.Bbs.Application.Contracts.Dtos.Plate;
using Yi.Framework.Bbs.Application.Contracts.IServices;
using Yi.Framework.Bbs.Domain.Entities;
using Yi.Framework.Ddd.Application;
namespace Yi.Framework.Bbs.Application.Services
{
/// <summary>
/// Plate服务实现
/// </summary>
public class PlateService : YiCrudAppService<PlateEntity, PlateGetOutputDto, PlateGetListOutputDto, Guid, PlateGetListInputVo, PlateCreateInputVo, PlateUpdateInputVo>,
IPlateService
{
public PlateService(IRepository<PlateEntity, Guid> repository) : base(repository)
{
}
}
}

View File

@@ -0,0 +1,22 @@
using Volo.Abp.Application.Services;
using Yi.Framework.Bbs.Application.Contracts.IServices;
namespace Yi.Framework.Bbs.Application.Services
{
/// <summary>
/// Setting服务实现
/// </summary>
public class SettingService : ApplicationService,
ISettingService
{
/// <summary>
/// 获取配置标题
/// </summary>
/// <returns></returns>
/// <exception cref="NotImplementedException"></exception>
public Task<string> GetTitleAsync()
{
return Task.FromResult("你好世界");
}
}
}

View File

@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\rbac\Yi.Framework.Rbac.Application\Yi.Framework.Rbac.Application.csproj" />
<ProjectReference Include="..\Yi.Framework.Bbs.Application.Contracts\Yi.Framework.Bbs.Application.Contracts.csproj" />
<ProjectReference Include="..\Yi.Framework.Bbs.Domain\Yi.Framework.Bbs.Domain.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,163 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.Framework.Bbs.Application</name>
</assembly>
<members>
<member name="M:Yi.Framework.Bbs.Application.Services.AccessLogService.AccessAsync">
<summary>
触发
</summary>
<returns></returns>
</member>
<member name="M:Yi.Framework.Bbs.Application.Services.AccessLogService.GetWeekAsync">
<summary>
获取当前周数据
</summary>
<returns></returns>
</member>
<member name="T:Yi.Framework.Bbs.Application.Services.AgreeService">
<summary>
点赞功能
</summary>
</member>
<member name="M:Yi.Framework.Bbs.Application.Services.AgreeService.PostOperateAsync(System.Guid)">
<summary>
点赞,返回true为点赞+1返回false为点赞-1
</summary>
<returns></returns>
</member>
<member name="T:Yi.Framework.Bbs.Application.Services.ArticleService">
<summary>
Article服务实现
</summary>
</member>
<member name="M:Yi.Framework.Bbs.Application.Services.ArticleService.GetAllAsync(System.Guid)">
<summary>
获取文章全部平铺信息
</summary>
<param name="discussId"></param>
<returns></returns>
<exception cref="T:Volo.Abp.UserFriendlyException"></exception>
</member>
<member name="M:Yi.Framework.Bbs.Application.Services.ArticleService.GetDiscussIdAsync(System.Guid)">
<summary>
查询文章
</summary>
<param name="discussId"></param>
<returns></returns>
<exception cref="T:Volo.Abp.UserFriendlyException"></exception>
</member>
<member name="M:Yi.Framework.Bbs.Application.Services.ArticleService.CreateAsync(Yi.Framework.Bbs.Application.Contracts.Dtos.Article.ArticleCreateInputVo)">
<summary>
发表文章
</summary>
<param name="input"></param>
<returns></returns>
<exception cref="T:Volo.Abp.UserFriendlyException"></exception>
</member>
<member name="M:Yi.Framework.Bbs.Application.Services.ArticleService.VerifyDiscussCreateIdAsync(System.Nullable{System.Guid})">
<summary>
效验创建权限
</summary>
<param name="userId"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.Bbs.Application.Services.BannerService">
<summary>
Banner服务实现
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Application.Services.CommentService">
<summary>
评论
</summary>
</member>
<member name="M:Yi.Framework.Bbs.Application.Services.CommentService.GetDiscussIdAsync(System.Guid,Yi.Framework.Bbs.Application.Contracts.Dtos.Comment.CommentGetListInputVo)">
<summary>
获取改主题下的评论,结构为二维列表,该查询无分页
</summary>
<param name="discussId"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Bbs.Application.Services.CommentService.CreateAsync(Yi.Framework.Bbs.Application.Contracts.Dtos.Comment.CommentCreateInputVo)">
<summary>
发表评论
</summary>
<param name="input"></param>
<returns></returns>
<exception cref="T:Volo.Abp.UserFriendlyException"></exception>
</member>
<member name="T:Yi.Framework.Bbs.Application.Services.DiscussService">
<summary>
Discuss应用服务实现,用于参数效验、领域服务业务组合、日志记录、事务处理、账户信息
</summary>
</member>
<member name="M:Yi.Framework.Bbs.Application.Services.DiscussService.GetAsync(System.Guid)">
<summary>
单查
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Bbs.Application.Services.DiscussService.GetListAsync(Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss.DiscussGetListInputVo)">
<summary>
查询
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Bbs.Application.Services.DiscussService.CreateAsync(Yi.Framework.Bbs.Application.Contracts.Dtos.Discuss.DiscussCreateInputVo)">
<summary>
创建主题
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Bbs.Application.Services.DiscussService.VerifyDiscussPermissionAsync(System.Guid)">
<summary>
效验主题查询权限
</summary>
<param name="discussId"></param>
<returns></returns>
<exception cref="T:Volo.Abp.UserFriendlyException"></exception>
</member>
<member name="T:Yi.Framework.Bbs.Application.Services.MyTypeService">
<summary>
Label服务实现
</summary>
</member>
<member name="M:Yi.Framework.Bbs.Application.Services.MyTypeService.GetListCurrentAsync(Yi.Framework.Bbs.Application.Contracts.Dtos.MyType.MyTypeGetListInputVo)">
<summary>
获取当前用户的主题类型
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Framework.Bbs.Application.Services.MyTypeService.CreateAsync(Yi.Framework.Bbs.Application.Contracts.Dtos.MyType.MyTypeCreateInputVo)">
<summary>
创建
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.Bbs.Application.Services.PlateService">
<summary>
Plate服务实现
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Application.Services.SettingService">
<summary>
Setting服务实现
</summary>
</member>
<member name="M:Yi.Framework.Bbs.Application.Services.SettingService.GetTitleAsync">
<summary>
获取配置标题
</summary>
<returns></returns>
<exception cref="T:System.NotImplementedException"></exception>
</member>
</members>
</doc>

View File

@@ -0,0 +1,18 @@
using Volo.Abp.Modularity;
using Yi.Framework.Bbs.Application.Contracts;
using Yi.Framework.Bbs.Domain;
using Yi.Framework.Rbac.Application;
namespace Yi.Framework.Bbs.Application
{
[DependsOn(typeof(YiFrameworkBbsDomainModule),
typeof(YiFrameworkBbsApplicationContractsModule),
typeof(YiFrameworkRbacApplicationModule)
)]
public class YiFrameworkBbsApplicationModule : AbpModule
{
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Bbs.Domain.Shared.Consts
{
/// <summary>
/// 常量定义
/// </summary>
public class ArticleConst
{
public const string No_Exist = "传入的文章id不存在";
public const string No_Permission = "该文章无权限";
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Bbs.Domain.Shared.Consts
{
/// <summary>
/// 常量定义
/// </summary>
public class CommentConst
{
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Bbs.Domain.Shared.Consts
{
/// <summary>
/// 常量定义
/// </summary>
public class DiscussConst
{
public const string No_Exist = "传入的主题id不存在";
public const string Privacy = "【私密】您无该主题权限,可联系作者申请开放";
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Bbs.Domain.Shared.Consts
{
/// <summary>
/// 常量定义
/// </summary>
public class LabelConst
{
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Bbs.Domain.Shared.Consts
{
/// <summary>
/// 常量定义
/// </summary>
public class PlateConst
{
public const string No_Exist = "传入的板块id不存在";
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Bbs.Domain.Shared.Enums
{
public enum DiscussPermissionTypeEnum
{
/// <summary>
/// 默认:公开
/// </summary>
Public = 0,
/// <summary>
/// 仅自己可见
/// </summary>
Oneself,
/// <summary>
/// 部分用户可见
/// </summary>
User
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Bbs.Domain.Shared.Enums
{
public enum QueryDiscussTypeEnum
{
New,
Suggest,
Host
}
}

View File

@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\rbac\Yi.Framework.Rbac.Domain.Shared\Yi.Framework.Rbac.Domain.Shared.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,48 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.Framework.Bbs.Domain.Shared</name>
</assembly>
<members>
<member name="T:Yi.Framework.Bbs.Domain.Shared.Consts.ArticleConst">
<summary>
常量定义
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Domain.Shared.Consts.CommentConst">
<summary>
常量定义
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Domain.Shared.Consts.DiscussConst">
<summary>
常量定义
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Domain.Shared.Consts.LabelConst">
<summary>
常量定义
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Domain.Shared.Consts.PlateConst">
<summary>
常量定义
</summary>
</member>
<member name="F:Yi.Framework.Bbs.Domain.Shared.Enums.DiscussPermissionTypeEnum.Public">
<summary>
默认:公开
</summary>
</member>
<member name="F:Yi.Framework.Bbs.Domain.Shared.Enums.DiscussPermissionTypeEnum.Oneself">
<summary>
仅自己可见
</summary>
</member>
<member name="F:Yi.Framework.Bbs.Domain.Shared.Enums.DiscussPermissionTypeEnum.User">
<summary>
部分用户可见
</summary>
</member>
</members>
</doc>

View File

@@ -0,0 +1,12 @@
using Volo.Abp.Modularity;
using Yi.Framework.Rbac.Domain.Shared;
namespace Yi.Framework.Bbs.Domain.Shared
{
[DependsOn(
typeof(YiFrameworkRbacDomainSharedModule))]
public class YiFrameworkBbsDomainSharedModule : AbpModule
{
}
}

View File

@@ -0,0 +1,16 @@
using SqlSugar;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
namespace Yi.Framework.Bbs.Domain.Entities
{
[SugarTable("AccessLog")]
public class AccessLogEntity : Entity<Guid>, IHasModificationTime, IHasCreationTime
{
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
public override Guid Id { get; protected set; }
public long Number { get; set; }
public DateTime? LastModificationTime { get; set; }
public DateTime CreationTime { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
using SqlSugar;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
namespace Yi.Framework.Bbs.Domain.Entities
{
[SugarTable("Agree")]
public class AgreeEntity : Entity<Guid>, ICreationAuditedObject
{
public AgreeEntity()
{
}
public AgreeEntity(Guid discussId)
{
DiscussId = discussId;
}
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
public override Guid Id { get; protected set; }
public DateTime CreationTime { get; set; }
/// <summary>
/// 主题id
/// </summary>
public Guid DiscussId { get; set; }
/// <summary>
/// 创建者
/// </summary>
public Guid? CreatorId { get; set; }
}
}

View File

@@ -0,0 +1,56 @@
using SqlSugar;
using Volo.Abp;
using Volo.Abp.Domain.Entities;
namespace Yi.Framework.Bbs.Domain.Entities
{
[SugarTable("Article")]
public class ArticleEntity : Entity<Guid>, ISoftDelete
{
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
public override Guid Id { get; protected set; }
public bool IsDeleted { get; set; }
[SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string Content { get; set; }
public string Name { get; set; }
public Guid DiscussId { get; set; }
public Guid ParentId { get; set; }
[SugarColumn(IsIgnore = true)]
public List<ArticleEntity>? Children { get; set; }
}
public static class ArticleEntityExtensions
{
/// <summary>
/// 平铺自己
/// </summary>
/// <param name="entities"></param>
/// <returns></returns>
public static List<ArticleEntity> Tile(this List<ArticleEntity> entities)
{
if (entities is null) return new List<ArticleEntity>();
var result = new List<ArticleEntity>();
return StartRecursion(entities, result);
}
private static List<ArticleEntity> StartRecursion(List<ArticleEntity> entities, List<ArticleEntity> result)
{
foreach (var entity in entities)
{
result.Add(entity);
if (entity.Children is not null && entity.Children.Where(x => x.IsDeleted == false).Count() > 0)
{
StartRecursion(entity.Children, result);
}
}
return result;
}
}
}

View File

@@ -0,0 +1,25 @@
using SqlSugar;
using Volo.Abp;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
namespace Yi.Framework.Bbs.Domain.Entities
{
[SugarTable("Banner")]
public class BannerEntity : Entity<Guid>, ISoftDelete, IAuditedObject
{
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
public override Guid Id { get; protected set; }
public string Name { get; set; }
public string? Logo { get; set; }
public string? Color { get; set; }
public bool IsDeleted { get; set; }
public DateTime CreationTime { get; set; }
public Guid? CreatorId { get; set; }
public Guid? LastModifierId { get; set; }
public DateTime? LastModificationTime { get; set; }
}
}

View File

@@ -0,0 +1,65 @@
using SqlSugar;
using Volo.Abp;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
using Yi.Framework.Rbac.Domain.Entities;
namespace Yi.Framework.Bbs.Domain.Entities
{
/// <summary>
/// 评论表
/// </summary>
[SugarTable("Comment")]
public class CommentEntity : Entity<Guid>, ISoftDelete, IAuditedObject
{
/// <summary>
/// 采用二维数组方式,不使用树形方式
/// </summary>
public CommentEntity()
{
}
public CommentEntity(Guid discussId)
{
DiscussId = discussId;
}
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
public override Guid Id { get; protected set; }
public bool IsDeleted { get; set; }
public string Content { get; set; }
public Guid DiscussId { get; set; }
/// <summary>
/// 被回复的CommentId
/// </summary>
public Guid ParentId { get; set; }
public DateTime CreationTime { get; set; }
public Guid RootId { get; set; }
[SugarColumn(IsIgnore = true)]
public List<CommentEntity> Children { get; set; } = new();
/// <summary>
/// 用户,评论人用户信息
/// </summary>
[Navigate(NavigateType.OneToOne, nameof(CreatorId))]
public UserEntity CreateUser { get; set; }
/// <summary>
/// 被评论的用户信息
/// </summary>
[SugarColumn(IsIgnore = true)]
public UserEntity CommentedUser { get; set; }
public Guid? CreatorId { get; set; }
public Guid? LastModifierId { get; set; }
public DateTime? LastModificationTime { get; set; }
}
}

View File

@@ -0,0 +1,61 @@
using SqlSugar;
using Volo.Abp;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
using Yi.Framework.Bbs.Domain.Shared.Enums;
namespace Yi.Framework.Bbs.Domain.Entities
{
[SugarTable("Discuss")]
public class DiscussEntity : Entity<Guid>, ISoftDelete, IAuditedObject
{
public DiscussEntity()
{
}
public DiscussEntity(Guid plateId)
{
PlateId = plateId;
}
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
public override Guid Id { get; protected 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; }
/// <summary>
/// 封面
/// </summary>
public string? Cover { get; set; }
[SugarColumn(ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string Content { get; set; }
public string? Color { get; set; }
public bool IsDeleted { get; set; }
//是否置顶默认false
public bool IsTop { get; set; }
public DiscussPermissionTypeEnum PermissionType { get; set; }
public Guid PlateId { get; set; }
public DateTime CreationTime { get; set; }
public Guid? CreatorId { get; set; }
public Guid? LastModifierId { get; set; }
public DateTime? LastModificationTime { get; set; }
/// <summary>
/// 当PermissionType为部分用户时候以下列表中的用户+创建者 代表拥有权限
/// </summary>
[SugarColumn(IsJson = true)]//使用json处理
public List<Guid>? PermissionUserIds { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using SqlSugar;
using Volo.Abp.Domain.Entities;
namespace Yi.Framework.Bbs.Domain.Entities
{
[SugarTable("DiscussMyType")]
public class DiscussMyTypeEntity : Entity<Guid>
{
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
public override Guid Id { get; protected set; }
public Guid DiscussId { get; set; }
public Guid MyTypeId { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
using SqlSugar;
using Volo.Abp;
using Volo.Abp.Domain.Entities;
namespace Yi.Framework.Bbs.Domain.Entities
{
[SugarTable("MyType")]
public class MyTypeEntity : Entity<Guid>, ISoftDelete
{
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
public override Guid Id { get; protected set; }
public bool IsDeleted { get; set; }
public string Name { get; set; }
public string? Color { get; set; }
public string? BackgroundColor { get; set; }
public Guid UserId { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using SqlSugar;
using Volo.Abp.Domain.Entities;
using Volo.Abp;
namespace Yi.Framework.Bbs.Domain.Entities
{
[SugarTable("Plate")]
public class PlateEntity : Entity<Guid>, ISoftDelete
{
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
public override Guid Id { get; protected set; }
public string Name { get; set; }
public string? Logo { get; set; }
public string? Introduction { get; set; }
public bool IsDeleted { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using SqlSugar;
using Volo.Abp.Domain.Entities;
namespace Yi.Framework.Bbs.Domain.Entities
{
[SugarTable("Setting")]
public class SettingEntity : Entity<Guid>
{
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
public override Guid Id { get; protected set; }
public int CommentPage { get; set; }
public int DiscussPage { get; set; }
public int CommentExperience { get; set; }
public int DiscussExperience { get; set; }
public string Title { get; set; }
}
}

View File

@@ -0,0 +1,40 @@
using Volo.Abp.Domain.Services;
using Yi.Framework.Bbs.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Bbs.Domain.Managers
{
/// <summary>
/// 论坛模块的领域服务
/// </summary>
public class ForumManager : DomainService
{
public readonly ISqlSugarRepository<DiscussEntity,Guid> _discussRepository;
public readonly ISqlSugarRepository<PlateEntity, Guid> _plateEntityRepository;
public readonly ISqlSugarRepository<CommentEntity, Guid> _commentRepository;
public ForumManager(ISqlSugarRepository<DiscussEntity, Guid> discussRepository, ISqlSugarRepository<PlateEntity, Guid> plateEntityRepository, ISqlSugarRepository<CommentEntity, Guid> commentRepository)
{
_discussRepository = discussRepository;
_plateEntityRepository = plateEntityRepository;
_commentRepository = commentRepository;
}
//主题是不能直接创建的,需要由领域服务统一创建
public async Task<DiscussEntity> CreateDiscussAsync(DiscussEntity entity)
{
entity.CreationTime = DateTime.Now;
entity.AgreeNum = 0;
entity.SeeNum = 0;
return await _discussRepository.InsertReturnEntityAsync(entity);
}
public async Task<CommentEntity> CreateCommentAsync(Guid discussId, Guid parentId, Guid rootId, string content)
{
var entity = new CommentEntity(discussId);
entity.Content = content;
entity.ParentId = parentId;
entity.RootId = rootId;
return await _commentRepository.InsertReturnEntityAsync(entity);
}
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Bbs.Domain.Entities;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Framework.Bbs.Domain.Repositories
{
public interface IArticleRepository: ISqlSugarRepository<ArticleEntity,Guid>
{
Task<List<ArticleEntity>> GetTreeAsync(Expression<Func<ArticleEntity, bool>> where);
}
}

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\rbac\Yi.Framework.Rbac.Domain\Yi.Framework.Rbac.Domain.csproj" />
<ProjectReference Include="..\Yi.Framework.Bbs.Domain.Shared\Yi.Framework.Bbs.Domain.Shared.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,65 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.Framework.Bbs.Domain</name>
</assembly>
<members>
<member name="P:Yi.Framework.Bbs.Domain.Entities.AgreeEntity.DiscussId">
<summary>
主题id
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Domain.Entities.AgreeEntity.CreatorId">
<summary>
创建者
</summary>
</member>
<member name="M:Yi.Framework.Bbs.Domain.Entities.ArticleEntityExtensions.Tile(System.Collections.Generic.List{Yi.Framework.Bbs.Domain.Entities.ArticleEntity})">
<summary>
平铺自己
</summary>
<param name="entities"></param>
<returns></returns>
</member>
<member name="T:Yi.Framework.Bbs.Domain.Entities.CommentEntity">
<summary>
评论表
</summary>
</member>
<member name="M:Yi.Framework.Bbs.Domain.Entities.CommentEntity.#ctor">
<summary>
采用二维数组方式,不使用树形方式
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Domain.Entities.CommentEntity.ParentId">
<summary>
被回复的CommentId
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Domain.Entities.CommentEntity.CreateUser">
<summary>
用户,评论人用户信息
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Domain.Entities.CommentEntity.CommentedUser">
<summary>
被评论的用户信息
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Domain.Entities.DiscussEntity.Cover">
<summary>
封面
</summary>
</member>
<member name="P:Yi.Framework.Bbs.Domain.Entities.DiscussEntity.PermissionUserIds">
<summary>
当PermissionType为部分用户时候以下列表中的用户+创建者 代表拥有权限
</summary>
</member>
<member name="T:Yi.Framework.Bbs.Domain.Managers.ForumManager">
<summary>
论坛模块的领域服务
</summary>
</member>
</members>
</doc>

View File

@@ -0,0 +1,16 @@
using Volo.Abp.Modularity;
using Yi.Framework.Bbs.Domain.Shared;
using Yi.Framework.Rbac.Domain;
namespace Yi.Framework.Bbs.Domain
{
[DependsOn(
typeof(YiFrameworkBbsDomainSharedModule),
typeof(YiFrameworkRbacDomainModule)
)]
public class YiFrameworkBbsDomainModule : AbpModule
{
}
}

View File

@@ -0,0 +1,21 @@
using System.Linq.Expressions;
using Volo.Abp.DependencyInjection;
using Yi.Framework.Bbs.Domain.Entities;
using Yi.Framework.Bbs.Domain.Repositories;
using Yi.Framework.SqlSugarCore.Abstractions;
using Yi.Framework.SqlSugarCore.Repositories;
namespace Yi.Framework.Bbs.SqlSugarCore.Repositories
{
public class ArticleRepository : SqlSugarRepository<ArticleEntity,Guid>, IArticleRepository,ITransientDependency
{
public ArticleRepository(ISugarDbContextProvider<ISqlSugarDbContext> sugarDbContextProvider) : base(sugarDbContextProvider)
{
}
public async Task<List<ArticleEntity>> GetTreeAsync(Expression<Func<ArticleEntity, bool>> where)
{
return await _DbQueryable.Where(where).ToTreeAsync(x => x.Children, x => x.ParentId, 0);
}
}
}

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\rbac\Yi.Framework.Rbac.SqlSugarCore\Yi.Framework.Rbac.SqlSugarCore.csproj" />
<ProjectReference Include="..\Yi.Framework.Bbs.Domain\Yi.Framework.Bbs.Domain.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.Framework.Bbs.SqlSugarCore</name>
</assembly>
<members>
</members>
</doc>

View File

@@ -0,0 +1,15 @@
using Volo.Abp.Modularity;
using Yi.Framework.Bbs.Domain;
using Yi.Framework.Rbac.SqlSugarCore;
namespace Yi.Framework.Bbs.SqlSugarCore
{
[DependsOn(
typeof(YiFrameworkBbsDomainModule),
typeof(YiFrameworkRbacSqlSugarCoreModule))]
public class YiFrameworkBbsSqlSugarCoreModule : AbpModule
{
}
}

View File

@@ -0,0 +1,8 @@
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Account
{
public class CaptchaImageDto
{
public Guid Uuid { get; set; } = Guid.Empty;
public byte[] Img { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Account
{
public class LoginInputVo
{
public string UserName { get; set; } = string.Empty;
public string Password { get; set; } = string.Empty;
public string Uuid { get; set; }
public string Code { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Account
{
public class PhoneCaptchaImageDto
{
public string Phone { get; set; }
}
}

View File

@@ -0,0 +1,33 @@
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Account
{
public class RegisterDto
{
//电话号码根据code的表示来获取
/// <summary>
/// 账号
/// </summary>
public string UserName { get; set; } = string.Empty;
/// <summary>
/// 密码
/// </summary>
public string Password { get; set; } = string.Empty;
/// <summary>
/// 唯一标识码
/// </summary>
public string? Uuid { get; set; }
/// <summary>
/// 电话
/// </summary>
public long Phone { get; set; }
/// <summary>
/// 验证码
/// </summary>
public string? Code { get; set; }
}
}

View File

@@ -0,0 +1,7 @@
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Account
{
public class RestPasswordDto
{
public string Password { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,7 @@
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Account
{
public class UpdateIconDto
{
public string? Icon { get; set; }
}
}

View File

@@ -0,0 +1,8 @@
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Account
{
public class UpdatePasswordDto
{
public string NewPassword { get; set; } = string.Empty;
public string OldPassword { get; set; } = string.Empty;
}
}

View File

@@ -0,0 +1,17 @@
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Config
{
/// <summary>
/// Config输入创建对象
/// </summary>
public class ConfigCreateInputVo
{
public Guid Id { get; set; }
public string ConfigName { get; set; } = string.Empty;
public string ConfigKey { get; set; } = string.Empty;
public string ConfigValue { get; set; } = string.Empty;
public string? ConfigType { get; set; }
public int OrderNum { get; set; }
public string? Remark { get; set; }
public DateTime CreationTime { get; set; }
}
}

View File

@@ -0,0 +1,22 @@
using Yi.Framework.Ddd;
using Yi.Framework.Ddd.Application.Contracts;
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Config
{
/// <summary>
/// <20><><EFBFBD>ò<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
/// </summary>
public class ConfigGetListInputVo : PagedAllResultRequestDto
{
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
public string? ConfigName { get; set; }
/// <summary>
/// <20><><EFBFBD>ü<EFBFBD>
/// </summary>
public string? ConfigKey { get; set; }
}
}

View File

@@ -0,0 +1,40 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Config
{
public class ConfigGetListOutputDto : EntityDto<Guid>
{
public Guid Id { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
public string ConfigName { get; set; } = string.Empty;
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
public string ConfigKey { get; set; } = string.Empty;
/// <summary>
/// <20><><EFBFBD><EFBFBD>ֵ
/// </summary>
public string ConfigValue { get; set; } = string.Empty;
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
public string? ConfigType { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>
/// </summary>
public int OrderNum { get; set; }
/// <summary>
/// <20><>ע
/// </summary>
public string? Remark { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
/// </summary>
public DateTime CreationTime { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Config
{
public class ConfigGetOutputDto : EntityDto<Guid>
{
public string ConfigName { get; set; } = string.Empty;
public string ConfigKey { get; set; } = string.Empty;
public string ConfigValue { get; set; } = string.Empty;
public string? ConfigType { get; set; }
public int OrderNum { get; set; }
public string? Remark { get; set; }
public DateTime CreationTime { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Config
{
public class ConfigUpdateInputVo
{
public Guid Id { get; set; }
public string ConfigName { get; set; } = string.Empty;
public string ConfigKey { get; set; } = string.Empty;
public string ConfigValue { get; set; } = string.Empty;
public string? ConfigType { get; set; }
public int OrderNum { get; set; }
public string? Remark { get; set; }
public DateTime CreationTime { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Dept
{
/// <summary>
/// Dept输入创建对象
/// </summary>
public class DeptCreateInputVo
{
public Guid Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public Guid? CreatorId { get; set; }
public bool State { get; set; }
public string DeptName { get; set; } = string.Empty;
public string DeptCode { get; set; } = string.Empty;
public string? Leader { get; set; }
public Guid ParentId { get; set; }
public string? Remark { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using Yi.Framework.Ddd;
using Yi.Framework.Ddd.Application.Contracts;
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Dept
{
public class DeptGetListInputVo : PagedAllResultRequestDto
{
public Guid Id { get; set; }
public bool? State { get; set; }
public string? DeptName { get; set; }
public string? DeptCode { get; set; }
public string? Leader { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using Volo.Abp.Application.Dtos;
namespace Yi.Framework.Rbac.Application.Contracts.Dtos.Dept
{
public class DeptGetListOutputDto : EntityDto<Guid>
{
public DateTime CreationTime { get; set; } = DateTime.Now;
public Guid? CreatorId { get; set; }
public bool State { get; set; }
public string DeptName { get; set; } = string.Empty;
public string DeptCode { get; set; } = string.Empty;
public string? Leader { get; set; }
public Guid ParentId { get; set; }
public string? Remark { get; set; }
public int OrderNum { get; set; }
}
}

Some files were not shown because too many files have changed in this diff Show More