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,53 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Data.Filters
{
public class DefaultDataFilter : IDataFilter
{
private readonly IServiceProvider _serviceProvider;
public DefaultDataFilter(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public IDisposable Disable<TFilter>() where TFilter : class
{
return this;
}
public IDisposable Enable<TFilter>() where TFilter : class
{
return this;
}
public bool IsEnabled<TFilter>() where TFilter : class
{
return false;
}
public void RemoveFilter<TFilter>() where TFilter : class
{
}
public void RemoveAndBackup<TFilter>() where TFilter : class
{
}
public void AddFilter<TFilter>(Expression<Func<TFilter, bool>> expression) where TFilter : class
{
}
public void Dispose()
{
}
}
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Framework.Infrastructure.Data.Filters
{
public interface IDataFilter : IDisposable
{
IDisposable Enable<TFilter>() where TFilter : class;
IDisposable Disable<TFilter>() where TFilter : class;
bool IsEnabled<TFilter>() where TFilter : class;
void AddFilter<TFilter>(Expression<Func<TFilter, bool>> expression) where TFilter : class;
void RemoveFilter<TFilter>() where TFilter : class;
}
}

View File

@@ -77,6 +77,7 @@ where TEntityDto : IEntityDto<TKey>
/// </summary> /// </summary>
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[Route("")]
public virtual async Task<PagedResultDto<TGetListOutputDto>> GetListAsync([FromQuery]TGetListInput input) public virtual async Task<PagedResultDto<TGetListOutputDto>> GetListAsync([FromQuery]TGetListInput input)
{ {
var totalCount = -1; var totalCount = -1;

View File

@@ -0,0 +1,45 @@
using System.Linq.Expressions;
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Filters;
namespace Yi.Framework.Infrastructure.Sqlsugar.Filters
{
public class SqlsugarDataFilter : IDataFilter
{
private ISqlSugarClient _Db { get; set; }
public SqlsugarDataFilter(ISqlSugarClient sqlSugarClient)
{
_Db = sqlSugarClient;
}
public void AddFilter<TFilter>(Expression<Func<TFilter, bool>> expression) where TFilter : class
{
_Db.QueryFilter.AddTableFilter(expression);
}
public IDisposable Disable<TFilter>() where TFilter : class
{
_Db.QueryFilter.ClearAndBackup<TFilter>();
return this;
}
public IDisposable Enable<TFilter>() where TFilter : class
{
throw new NotImplementedException("暂时没有单独还原过滤器的方式");
}
public bool IsEnabled<TFilter>() where TFilter : class
{
throw new NotImplementedException("暂时没有判断过滤器的方式");
}
public void RemoveFilter<TFilter>() where TFilter : class
{
_Db.QueryFilter.Clear<TFilter>();
}
public void Dispose()
{
_Db.QueryFilter.Restore();
}
}
}

View File

@@ -8,6 +8,8 @@ using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Yi.Framework.Infrastructure.CurrentUsers; using Yi.Framework.Infrastructure.CurrentUsers;
using Yi.Framework.Infrastructure.Data.Auditing;
using Yi.Framework.Infrastructure.Data.Entities;
namespace Yi.Framework.Infrastructure.Sqlsugar namespace Yi.Framework.Infrastructure.Sqlsugar
{ {
@@ -83,45 +85,45 @@ namespace Yi.Framework.Infrastructure.Sqlsugar
db.Aop.DataExecuting = (oldValue, entityInfo) => db.Aop.DataExecuting = (oldValue, entityInfo) =>
{ {
//switch (entityInfo.OperationType) switch (entityInfo.OperationType)
{
case DataFilterType.UpdateByObject:
if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.LastModificationTime)))
{
entityInfo.SetValue(DateTime.Now);
}
if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.LastModifierId)))
{
if (_currentUser != null)
{
entityInfo.SetValue(_currentUser.Id);
}
}
break;
case DataFilterType.InsertByObject:
if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.CreationTime)))
{
entityInfo.SetValue(DateTime.Now);
}
if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.CreatorId)))
{
if (_currentUser != null)
{
entityInfo.SetValue(_currentUser.Id);
}
}
//插入时需要租户id,先预留
if (entityInfo.PropertyName.Equals(nameof(IMultiTenant.TenantId)))
{
//if (this.CurrentTenant is not null)
//{ //{
// case DataFilterType.UpdateByObject: // entityInfo.SetValue(this.CurrentTenant.Id);
// if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.LastModificationTime)))
// {
// entityInfo.SetValue(DateTime.Now);
// }
// if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.LastModifierId)))
// {
// if (_currentUser != null)
// {
// entityInfo.SetValue(_currentUser.Id);
// }
// }
// break;
// case DataFilterType.InsertByObject:
// if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.CreationTime)))
// {
// entityInfo.SetValue(DateTime.Now);
// }
// if (entityInfo.PropertyName.Equals(nameof(IAuditedObject.CreatorId)))
// {
// if (_currentUser != null)
// {
// entityInfo.SetValue(_currentUser.Id);
// }
// }
// //插入时需要租户id,先预留
// if (entityInfo.PropertyName.Equals(nameof(IMultiTenant.TenantId)))
// {
// //if (this.CurrentTenant is not null)
// //{
// // entityInfo.SetValue(this.CurrentTenant.Id);
// //}
// }
// break;
//} //}
}
break;
}
}; };
db.Aop.OnLogExecuting = (s, p) => db.Aop.OnLogExecuting = (s, p) =>
{ {

View File

@@ -3,8 +3,11 @@ using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using StackExchange.Profiling.SqlFormatters;
using Yi.Framework.Infrastructure.AspNetCore; using Yi.Framework.Infrastructure.AspNetCore;
using Yi.Framework.Infrastructure.Data.Filters;
using Yi.Framework.Infrastructure.Sqlsugar; using Yi.Framework.Infrastructure.Sqlsugar;
using Yi.Framework.Infrastructure.Sqlsugar.Filters;
using Yi.Framework.Infrastructure.Sqlsugar.Uow; using Yi.Framework.Infrastructure.Sqlsugar.Uow;
namespace Yi.Framework.Infrastructure; namespace Yi.Framework.Infrastructure;
@@ -20,6 +23,8 @@ public class Startup : AppStartup
services.AddDbSqlsugarContextServer(); services.AddDbSqlsugarContextServer();
services.AddUnitOfWork<SqlsugarUnitOfWork>(); services.AddUnitOfWork<SqlsugarUnitOfWork>();
services.AddTransient<IDataFilter, SqlsugarDataFilter>();
} }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) public void Configure(IApplicationBuilder app, IWebHostEnvironment env)

View File

@@ -0,0 +1,42 @@
using Yi.Framework.Infrastructure.Ddd.Repositories;
using Yi.Framework.Infrastructure.Helper;
using Yi.Furion.Core.Bbs.Entities;
namespace Yi.Furion.Application.Bbs.Domain
{
/// <summary>
/// 论坛模块的领域服务
/// </summary>
public class ForumManager:ITransient
{
private readonly IRepository<DiscussEntity> _discussRepository;
private readonly IRepository<PlateEntity> _plateEntityRepository;
private readonly IRepository<CommentEntity> _commentRepository;
public ForumManager(IRepository<DiscussEntity> discussRepository, IRepository<PlateEntity> plateEntityRepository, IRepository<CommentEntity> commentRepository)
{
_discussRepository = discussRepository;
_plateEntityRepository = plateEntityRepository;
_commentRepository = commentRepository;
}
//主题是不能直接创建的,需要由领域服务统一创建
public async Task<DiscussEntity> CreateDiscussAsync(DiscussEntity entity)
{
entity.Id = SnowflakeHelper.NextId;
entity.CreationTime = DateTime.Now;
entity.AgreeNum = 0;
entity.SeeNum = 0;
return await _discussRepository.InsertReturnEntityAsync(entity);
}
public async Task<CommentEntity> CreateCommentAsync(long discussId, long parentId, long rootId, string content)
{
var entity = new CommentEntity(discussId);
entity.Id = SnowflakeHelper.NextId;
entity.Content = content;
entity.ParentId = parentId;
entity.RootId = rootId;
return await _commentRepository.InsertReturnEntityAsync(entity);
}
}
}

View File

@@ -0,0 +1,29 @@
using Furion.EventBus;
using Microsoft.AspNetCore.Mvc.Diagnostics;
using Yi.Framework.Infrastructure.Ddd.Repositories;
using Yi.Furion.Core.Bbs.Entities;
using Yi.Furion.Core.Bbs.Etos;
namespace Yi.Furion.Application.Bbs.Event
{
public class SeeDiscussEventHandler : IEventSubscriber, ISingleton
{
private IRepository<DiscussEntity> _repository;
public SeeDiscussEventHandler(IRepository<DiscussEntity> repository)
{
_repository = repository;
}
//[EventSubscribe(nameof(LoginEventSource))]
public async Task HandlerAsync(EventHandlerExecutingContext context)
{
var eventData = (SeeDiscussEventArgs)context.Source.Payload;
var entity = await _repository.GetByIdAsync(eventData.DiscussId);
if (entity is not null)
{
entity.SeeNum += 1;
await _repository.UpdateAsync(entity);
}
}
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Core.Bbs.Dtos.Article;
namespace Yi.Furion.Application.Bbs.Services
{
/// <summary>
/// Article服务抽象
/// </summary>
public interface IArticleService : ICrudAppService<ArticleGetOutputDto, ArticleGetListOutputDto, long, ArticleGetListInputVo, ArticleCreateInputVo, ArticleUpdateInputVo>
{
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Core.Bbs.Dtos.Banner;
namespace Yi.Furion.Application.Bbs.Services
{
/// <summary>
/// Banner抽象
/// </summary>
public interface IBannerService : ICrudAppService<BannerGetOutputDto, BannerGetListOutputDto, long, BannerGetListInputVo, BannerCreateInputVo, BannerUpdateInputVo>
{
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Core.Bbs.Dtos.Comment;
namespace Yi.Furion.Application.Bbs.Services
{
/// <summary>
/// Comment服务抽象
/// </summary>
public interface ICommentService : ICrudAppService<CommentGetOutputDto, CommentGetListOutputDto, long, CommentGetListInputVo, CommentCreateInputVo, CommentUpdateInputVo>
{
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Core.Bbs.Dtos.Discuss;
namespace Yi.Furion.Application.Bbs.Services
{
/// <summary>
/// Discuss服务抽象
/// </summary>
public interface IDiscussService : ICrudAppService<DiscussGetOutputDto, DiscussGetListOutputDto, long, DiscussGetListInputVo, DiscussCreateInputVo, DiscussUpdateInputVo>
{
Task VerifyDiscussPermissionAsync(long discussId);
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Core.Bbs.Dtos.MyType;
namespace Yi.Furion.Application.Bbs.Services
{
/// <summary>
/// Label服务抽象
/// </summary>
public interface ILabelService : ICrudAppService<MyTypeOutputDto, MyTypeGetListOutputDto, long, MyTypeGetListInputVo, MyTypeCreateInputVo, MyTypeUpdateInputVo>
{
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Core.Bbs.Dtos.Plate;
namespace Yi.Furion.Application.Bbs.Services
{
/// <summary>
/// Plate服务抽象
/// </summary>
public interface IPlateService : ICrudAppService<PlateGetOutputDto, PlateGetListOutputDto, long, PlateGetListInputVo, PlateCreateInputVo, PlateUpdateInputVo>
{
}
}

View File

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

View File

@@ -0,0 +1,71 @@
using Yi.Framework.Infrastructure.CurrentUsers;
using Yi.Framework.Infrastructure.Ddd.Repositories;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Framework.Infrastructure.Exceptions;
using Yi.Furion.Core.Bbs.Dtos.Argee;
using Yi.Furion.Core.Bbs.Entities;
namespace Yi.Furion.Application.Bbs.Services.Impl
{
/// <summary>
/// 点赞功能
/// </summary>
public class AgreeService : ApplicationService, IApplicationService, IDynamicApiController, ITransient
{
public AgreeService(IRepository<AgreeEntity> repository, IRepository<DiscussEntity> discssRepository, ICurrentUser currentUser)
{
_repository = repository;
_currentUser = currentUser;
_discssRepository = discssRepository;
}
private IRepository<AgreeEntity> _repository { get; set; }
private IRepository<DiscussEntity> _discssRepository { get; set; }
private ICurrentUser _currentUser { get; set; }
/// <summary>
/// 点赞,返回true为点赞+1返回false为点赞-1
/// </summary>
/// <returns></returns>
[UnitOfWork]
public async Task<AgreeDto> PostOperateAsync(long discussId)
{
var entity = await _repository.GetFirstAsync(x => x.DiscussId == discussId && x.CreatorId == _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,113 @@
using Yi.Framework.Infrastructure.CurrentUsers;
using Yi.Framework.Infrastructure.Ddd.Repositories;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Framework.Infrastructure.Exceptions;
using Yi.Furion.Core.Bbs.Consts;
using Yi.Furion.Core.Bbs.Dtos.Article;
using Yi.Furion.Core.Bbs.Entities;
using Yi.Furion.Core.Rbac.Consts;
using Yi.Furion.Sqlsugar.Core.Repositories;
namespace Yi.Furion.Application.Bbs.Services.Impl
{
/// <summary>
/// Article服务实现
/// </summary>
public class ArticleService : CrudAppService<ArticleEntity, ArticleGetOutputDto, ArticleGetListOutputDto, long, ArticleGetListInputVo, ArticleCreateInputVo, ArticleUpdateInputVo>,
IArticleService, IDynamicApiController, ITransient
{
public ArticleService(IArticleRepository articleRepository,
IRepository<DiscussEntity> discussRepository,
ICurrentUser currentUser,
IDiscussService discussService)
{
_articleRepository = articleRepository;
_currentUser = currentUser;
_discussRepository = discussRepository;
_discussService = discussService;
}
private IArticleRepository _articleRepository { get; set; }
private IRepository<DiscussEntity> _discussRepository { get; set; }
private ICurrentUser _currentUser { get; set; }
private IDiscussService _discussService { get; set; }
/// <summary>
/// 获取文章全部平铺信息
/// </summary>
/// <param name="discussId"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[Route("/api/article/all/discuss-id/{discussId}")]
public async Task<List<ArticleAllOutputDto>> GetAllAsync([FromRoute] long discussId)
{
await _discussService.VerifyDiscussPermissionAsync(discussId);
var entities = await _articleRepository.GetTreeAsync(x => x.DiscussId == discussId);
//var result = entities.Tile();
var items = _mapper.Map<List<ArticleAllOutputDto>>(entities);
return items;
}
/// <summary>
/// 查询文章
/// </summary>
/// <param name="discussId"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
public async Task<List<ArticleGetListOutputDto>> GetDiscussIdAsync([FromRoute] long discussId)
{
if (!await _discussRepository.IsAnyAsync(x => x.Id == discussId))
{
throw new UserFriendlyException(DiscussConst.);
}
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.);
}
if (input.ParentId != 0 && !await _repository.IsAnyAsync(x => x.Id == input.ParentId))
{
throw new UserFriendlyException(ArticleConst.);
}
await VerifyDiscussCreateIdAsync(discuss.CreatorId);
return await base.CreateAsync(input);
}
/// <summary>
/// 效验创建权限
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public async Task VerifyDiscussCreateIdAsync(long? userId)
{
//只有文章是特殊的,不能在其他主题下创建
//主题的创建者不是当前用户,同时,没有权限或者超级管理
//false & true & false ,三个条件任意满意一个,即可成功使用||,最后取反,一个都不满足
//
if (userId != _currentUser.Id && !UserConst.Admin.Equals(_currentUser.UserName) && !_currentUser.Permission.Contains("bbs:discuss:add"))
{
throw new UserFriendlyException("无权限在其他用户主题中创建子文章");
}
}
}
}

View File

@@ -0,0 +1,14 @@
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Furion.Core.Bbs.Dtos.Banner;
using Yi.Furion.Core.Bbs.Entities;
namespace Yi.Furion.Application.Bbs.Services.Impl
{
/// <summary>
/// Banner服务实现
/// </summary>
public class BannerService : CrudAppService<BannerEntity, BannerGetOutputDto, BannerGetListOutputDto, long, BannerGetListInputVo, BannerCreateInputVo, BannerUpdateInputVo>,
IBannerService,IDynamicApiController,ITransient
{
}
}

View File

@@ -0,0 +1,107 @@
using SqlSugar;
using Yi.Framework.Infrastructure.CurrentUsers;
using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Repositories;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Framework.Infrastructure.Exceptions;
using Yi.Furion.Application.Bbs.Domain;
using Yi.Furion.Core.Bbs.Consts;
using Yi.Furion.Core.Bbs.Dtos.Comment;
using Yi.Furion.Core.Bbs.Entities;
namespace Yi.Furion.Application.Bbs.Services.Impl
{
/// <summary>
/// 评论
/// </summary>
public class CommentService : CrudAppService<CommentEntity, CommentGetOutputDto, CommentGetListOutputDto, long, CommentGetListInputVo, CommentCreateInputVo, CommentUpdateInputVo>,
ICommentService, IDynamicApiController, ITransient
{
public CommentService(ForumManager forumManager, ICurrentUser currentUser, IRepository<DiscussEntity> discussRepository, IDiscussService discussService)
{
_forumManager = forumManager;
_currentUser = currentUser;
_discussRepository = discussRepository;
_discussService=discussService;
}
private ForumManager _forumManager { get; set; }
private ICurrentUser _currentUser { get; set; }
private IRepository<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] long discussId, [FromQuery] CommentGetListInputVo input)
{
await _discussService.VerifyDiscussPermissionAsync(discussId);
var entities = await _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 == 0).OrderByDescending(x => x.CreationTime).ToList();
//将全部数据进行hash
var dic = entities.ToDictionary(x => x.Id);
foreach (var comment in entities)
{
//不是根节点,需要赋值 被评论者用户信息等
if (comment.ParentId != 0)
{
var parentComment = dic[comment.ParentId];
comment.CommentedUser = parentComment.CreateUser;
}
//root或者parent id根节点都是等于0的
var id = comment.RootId;
if (id is not 0)
{
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.);
}
var entity = await _forumManager.CreateCommentAsync(input.DiscussId, input.ParentId, input.RootId, input.Content);
return await MapToGetOutputDtoAsync(entity);
}
}
}

View File

@@ -0,0 +1,150 @@
using Furion.EventBus;
using SqlSugar;
using Yi.Framework.Infrastructure.CurrentUsers;
using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Repositories;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Framework.Infrastructure.Exceptions;
using Yi.Furion.Application.Bbs.Domain;
using Yi.Furion.Core.Bbs.Consts;
using Yi.Furion.Core.Bbs.Dtos.Discuss;
using Yi.Furion.Core.Bbs.Entities;
using Yi.Furion.Core.Bbs.Enums;
using Yi.Furion.Core.Bbs.Etos;
using Yi.Furion.Core.Rbac.Dtos.User;
using Yi.Furion.Core.Rbac.Entities;
namespace Yi.Furion.Application.Bbs.Services.Impl
{
/// <summary>
/// Discuss应用服务实现,用于参数效验、领域服务业务组合、日志记录、事务处理、账户信息
/// </summary>
public class DiscussService : CrudAppService<DiscussEntity, DiscussGetOutputDto, DiscussGetListOutputDto, long, DiscussGetListInputVo, DiscussCreateInputVo, DiscussUpdateInputVo>,
IDiscussService,IDynamicApiController,ITransient
{
public DiscussService(ICurrentUser currentUser, ForumManager forumManager, IRepository<PlateEntity> plateEntityRepository, IEventPublisher eventPublisher)
{
_currentUser = currentUser;
_forumManager = forumManager;
_plateEntityRepository= plateEntityRepository;
_eventPublisher= eventPublisher;
}
private ForumManager _forumManager { get; set; }
private IRepository<PlateEntity> _plateEntityRepository { get; set; }
private IEventPublisher _eventPublisher { get; set; }
//[Autowired]
private ICurrentUser _currentUser { get; set; }
/// <summary>
/// 单查
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async override Task<DiscussGetOutputDto> GetAsync(long id)
{
//查询主题发布 浏览主题 事件,浏览数+1
var item = await _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);
await VerifyDiscussPermissionAsync(item.Id);
if (item is not null)
{
_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 _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.PageNum, input.PageSize, total);
//查询完主题之后,要过滤一下私有的主题信息
items.ApplyPermissionTypeFilter(_currentUser.Id);
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.);
}
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(long discussId)
{
var discuss = await _repository.GetFirstAsync(x => x.Id == discussId);
if (discuss is null)
{
throw new UserFriendlyException(DiscussConst.);
}
if (discuss.PermissionType == DiscussPermissionTypeEnum.Oneself)
{
if (discuss.CreatorId != _currentUser.Id)
{
throw new UserFriendlyException(DiscussConst.);
}
}
if (discuss.PermissionType == DiscussPermissionTypeEnum.User)
{
if (discuss.CreatorId != _currentUser.Id && !discuss.PermissionUserIds.Contains(_currentUser.Id))
{
throw new UserFriendlyException(DiscussConst.);
}
}
}
}
}

View File

@@ -0,0 +1,54 @@
using Yi.Framework.Infrastructure.CurrentUsers;
using Yi.Framework.Infrastructure.Data.Filters;
using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Framework.Infrastructure.Helper;
using Yi.Furion.Core.Bbs.Dtos.MyType;
using Yi.Furion.Core.Bbs.Entities;
namespace Yi.Furion.Application.Bbs.Services.Impl
{
/// <summary>
/// Label服务实现
/// </summary>
public class MyTypeService : CrudAppService<MyTypeEntity, MyTypeOutputDto, MyTypeGetListOutputDto, long, MyTypeGetListInputVo, MyTypeCreateInputVo, MyTypeUpdateInputVo>,
ILabelService, IDynamicApiController, ITransient
{
public MyTypeService(ICurrentUser currentUser, IDataFilter dataFilter)
{
_currentUser = currentUser;
_dataFilter = dataFilter;
}
private ICurrentUser _currentUser { get; set; }
private IDataFilter _dataFilter { get; set; }
/// <summary>
/// 获取当前用户的主题类型
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public Task<PagedResultDto<MyTypeGetListOutputDto>> GetListCurrentAsync(MyTypeGetListInputVo input)
{
_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.Id = SnowflakeHelper.NextId;
entity.UserId = _currentUser.Id;
entity.IsDeleted = false;
var outputEntity = await _repository.InsertReturnEntityAsync(entity);
return await MapToGetOutputDtoAsync(outputEntity);
}
}
}

View File

@@ -0,0 +1,14 @@
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Furion.Core.Bbs.Dtos.Plate;
using Yi.Furion.Core.Bbs.Entities;
namespace Yi.Furion.Application.Bbs.Services.Impl
{
/// <summary>
/// Plate服务实现
/// </summary>
public class PlateService : CrudAppService<PlateEntity, PlateGetOutputDto, PlateGetListOutputDto, long, PlateGetListInputVo, PlateCreateInputVo, PlateUpdateInputVo>,
IPlateService,IDynamicApiController,ITransient
{
}
}

View File

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

View File

@@ -2,7 +2,7 @@
using Yi.Framework.Infrastructure.Ddd.Repositories; using Yi.Framework.Infrastructure.Ddd.Repositories;
using Yi.Framework.Infrastructure.Exceptions; using Yi.Framework.Infrastructure.Exceptions;
using Yi.Framework.Infrastructure.Helper; using Yi.Framework.Infrastructure.Helper;
using Yi.Furion.Core.Rbac.ConstClasses; using Yi.Furion.Core.Rbac.Consts;
using Yi.Furion.Core.Rbac.Dtos; using Yi.Furion.Core.Rbac.Dtos;
using Yi.Furion.Core.Rbac.Entities; using Yi.Furion.Core.Rbac.Entities;

View File

@@ -9,25 +9,22 @@ using Yi.Furion.Core.Rbac.Etos;
namespace Yi.Furion.Application.Rbac.Event namespace Yi.Furion.Application.Rbac.Event
{ {
public class LoginEventHandler : IEventSubscriber, ISingleton public class LoginEventHandler : IEventSubscriber,ISingleton
{ {
private readonly IRepository<LoginLogEntity> _loginLogRepository; private readonly IRepository<LoginLogEntity> _loginLogRepository;
private readonly IHttpContextAccessor _httpContextAccessor; public LoginEventHandler(IRepository<LoginLogEntity> loginLogRepository)
private HttpContext _httpContext => _httpContextAccessor.HttpContext;
public LoginEventHandler(IRepository<LoginLogEntity> loginLogRepository, IHttpContextAccessor httpContextAccessor)
{ {
_loginLogRepository = loginLogRepository; _loginLogRepository = loginLogRepository;
_httpContextAccessor = httpContextAccessor;
} }
//[EventSubscribe(nameof(LoginEventSource))] //[EventSubscribe(nameof(LoginEventSource))]
public Task HandlerAsync(EventHandlerExecutingContext context) public Task HandlerAsync(EventHandlerExecutingContext context)
{ {
var eventData = (LoginEventArgs)context.Source.Payload; var eventData = (LoginEventArgs)context.Source.Payload;
var loginLogEntity = GetLoginLogInfo(_httpContext); var loginLogEntity = GetLoginLogInfo(eventData.httpContext);
loginLogEntity.Id = SnowflakeHelper.NextId; loginLogEntity.Id = SnowflakeHelper.NextId;
loginLogEntity.LogMsg = eventData.UserName + "登录系统"; loginLogEntity.LogMsg = eventData.UserName + "登录系统";
loginLogEntity.LoginUser = eventData.UserName; loginLogEntity.LoginUser = eventData.UserName;
loginLogEntity.LoginIp = _httpContext.GetClientIp(); loginLogEntity.LoginIp = eventData.httpContext.GetClientIp();
_loginLogRepository.InsertAsync(loginLogEntity); _loginLogRepository.InsertAsync(loginLogEntity);
return Task.CompletedTask; return Task.CompletedTask;

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Core.Rbac.Dtos.Config;
namespace Yi.Furion.Application.Rbac.Services
{
/// <summary>
/// Config服务抽象
/// </summary>
public interface IConfigService : ICrudAppService<ConfigGetOutputDto, ConfigGetListOutputDto, long, ConfigGetListInputVo, ConfigCreateInputVo, ConfigUpdateInputVo>
{
}
}

View File

@@ -1,5 +1,5 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract; using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Application.Rbac.Dtos.Dept; using Yi.Furion.Core.Rbac.Dtos.Dept;
namespace Yi.Furion.Application.Rbac.Services namespace Yi.Furion.Application.Rbac.Services
{ {

View File

@@ -1,5 +1,5 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract; using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Application.Rbac.Dtos.Menu; using Yi.Furion.Core.Rbac.Dtos.Menu;
namespace Yi.Furion.Application.Rbac.Services namespace Yi.Furion.Application.Rbac.Services
{ {

View File

@@ -1,5 +1,5 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract; using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Application.Rbac.Dtos.Post; using Yi.Furion.Core.Rbac.Dtos.Post;
namespace Yi.Furion.Application.Rbac.Services namespace Yi.Furion.Application.Rbac.Services
{ {

View File

@@ -1,5 +1,5 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract; using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Application.Rbac.Dtos.Role; using Yi.Furion.Core.Rbac.Dtos.Role;
namespace Yi.Furion.Application.Rbac.Services namespace Yi.Furion.Application.Rbac.Services
{ {

View File

@@ -1,5 +1,5 @@
using Yi.Framework.Infrastructure.Ddd.Services.Abstract; using Yi.Framework.Infrastructure.Ddd.Services.Abstract;
using Yi.Furion.Application.Rbac.Dtos.User; using Yi.Furion.Core.Rbac.Dtos.User;
namespace Yi.Furion.Application.Rbac.Services namespace Yi.Furion.Application.Rbac.Services
{ {

View File

@@ -10,9 +10,9 @@ using Yi.Framework.Infrastructure.Exceptions;
using Yi.Framework.Module.ImageSharp.HeiCaptcha; using Yi.Framework.Module.ImageSharp.HeiCaptcha;
using Yi.Framework.Module.Sms.Aliyun; using Yi.Framework.Module.Sms.Aliyun;
using Yi.Furion.Application.Rbac.Domain; using Yi.Furion.Application.Rbac.Domain;
using Yi.Furion.Application.Rbac.Dtos.Account; using Yi.Furion.Core.Rbac.Consts;
using Yi.Furion.Core.Rbac.ConstClasses;
using Yi.Furion.Core.Rbac.Dtos; using Yi.Furion.Core.Rbac.Dtos;
using Yi.Furion.Core.Rbac.Dtos.Account;
using Yi.Furion.Core.Rbac.Entities; using Yi.Furion.Core.Rbac.Entities;
using Yi.Furion.Core.Rbac.Etos; using Yi.Furion.Core.Rbac.Etos;
using Yi.Furion.Sqlsugar.Core.Repositories; using Yi.Furion.Sqlsugar.Core.Repositories;
@@ -22,9 +22,9 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
public class AccountService : ApplicationService, ITransient, IDynamicApiController public class AccountService : ApplicationService, ITransient, IDynamicApiController
{ {
public AccountService(IUserRepository userRepository, ICurrentUser currentUser, AccountManager accountManager, IRepository<MenuEntity> menuRepository, SmsAliyunManager smsAliyunManager, IOptions<SmsAliyunOptions> smsAliyunManagerOptions, SecurityCodeHelper securityCode, IMemoryCache memoryCache, IEventPublisher eventPublisher) => public AccountService(IUserRepository userRepository, ICurrentUser currentUser, AccountManager accountManager, IRepository<MenuEntity> menuRepository, SmsAliyunManager smsAliyunManager, IOptions<SmsAliyunOptions> smsAliyunManagerOptions, SecurityCodeHelper securityCode, IMemoryCache memoryCache, IEventPublisher eventPublisher,IHttpContextAccessor httpContextAccessor) =>
(_userRepository, _currentUser, _accountManager, _menuRepository, _smsAliyunManager, _smsAliyunManagerOptions, _securityCode, _memoryCache, _eventPublisher) = (_userRepository, _currentUser, _accountManager, _menuRepository, _smsAliyunManager, _smsAliyunManagerOptions, _securityCode, _memoryCache, _eventPublisher, _httpContextAccessor) =
(userRepository, currentUser, accountManager, menuRepository, smsAliyunManager, smsAliyunManagerOptions, securityCode, memoryCache, eventPublisher); (userRepository, currentUser, accountManager, menuRepository, smsAliyunManager, smsAliyunManagerOptions, securityCode, memoryCache, eventPublisher, httpContextAccessor);
private IUserRepository _userRepository { get; set; } private IUserRepository _userRepository { get; set; }
@@ -62,6 +62,7 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
private SmsAliyunManager _smsAliyunManager { get; set; } private SmsAliyunManager _smsAliyunManager { get; set; }
private IHttpContextAccessor _httpContextAccessor { get; set; }
private IOptions<SmsAliyunOptions> _smsAliyunManagerOptions { get; set; } private IOptions<SmsAliyunOptions> _smsAliyunManagerOptions { get; set; }
@@ -124,17 +125,18 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
//这里抛出一个登录的事件 //这里抛出一个登录的事件
//不阻碍执行,无需等待 //不阻碍执行,无需等待
#pragma warning disable CS4014 // 由于此调用不会等待,因此在调用完成前将继续执行当前方法
_eventPublisher.PublishAsync(new LoginEventSource(new LoginEventArgs
await _eventPublisher.PublishAsync(new LoginEventSource(new LoginEventArgs
{ {
UserId = userInfo.User.Id, UserId = userInfo.User.Id,
UserName = user.UserName UserName = user.UserName,
httpContext= _httpContextAccessor.HttpContext
}) })
); );;
#pragma warning restore CS4014 // 由于此调用不会等待,因此在调用完成前将继续执行当前方法
//创建token //创建token
var accessToken = JWTEncryption.Encrypt(_accountManager.UserInfoToClaim(userInfo)); var accessToken = JWTEncryption.Encrypt(_accountManager.UserInfoToClaim(userInfo));
@@ -295,6 +297,7 @@ namespace Yi.Furion.Application.Rbac.Services.Impl
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[Authorize] [Authorize]
[Route("Vue3Router")]
public async Task<List<Vue3RouterDto>> GetVue3Router() public async Task<List<Vue3RouterDto>> GetVue3Router()
{ {
var userId = _currentUser.Id; var userId = _currentUser.Id;

View File

@@ -0,0 +1,34 @@
using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Furion.Core.Rbac.Dtos.Config;
using Yi.Furion.Core.Rbac.Entities;
namespace Yi.Furion.Application.Rbac.Services.Impl
{
/// <summary>
/// Config服务实现
/// </summary>
public class ConfigService : CrudAppService<ConfigEntity, ConfigGetOutputDto, ConfigGetListOutputDto, long, ConfigGetListInputVo, ConfigCreateInputVo, ConfigUpdateInputVo>,
IConfigService,IDynamicApiController,ITransient
{
/// <summary>
/// 多查
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public override async Task<PagedResultDto<ConfigGetListOutputDto>> GetListAsync(ConfigGetListInputVo input)
{
var entity = await MapToEntityAsync(input);
RefAsync<int> total = 0;
var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.ConfigKey), x => x.ConfigKey.Contains(input.ConfigKey!))
.WhereIF(!string.IsNullOrEmpty(input.ConfigName), x => x.ConfigName!.Contains(input.ConfigName!))
.WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
.ToPageListAsync(input.PageNum, input.PageSize, total);
return new PagedResultDto<ConfigGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
}
}
}

View File

@@ -1,7 +1,7 @@
using SqlSugar; using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos; using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services; using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Furion.Application.Rbac.Dtos.Dept; using Yi.Furion.Core.Rbac.Dtos.Dept;
using Yi.Furion.Core.Rbac.Entities; using Yi.Furion.Core.Rbac.Entities;
namespace Yi.Furion.Application.Rbac.Services.Impl namespace Yi.Furion.Application.Rbac.Services.Impl

View File

@@ -0,0 +1,30 @@
using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Furion.Core.Rbac.Dtos.LoginLog;
using Yi.Furion.Core.Rbac.Entities;
namespace Yi.Furion.Application.Rbac.Services.Impl
{
public class LoginLogService : CrudAppService<LoginLogEntity, LoginLogGetListOutputDto, long, LoginLogGetListInputVo>,IDynamicApiController,ITransient
{
public override async Task<PagedResultDto<LoginLogGetListOutputDto>> GetListAsync(LoginLogGetListInputVo input)
{
var entity = await MapToEntityAsync(input);
RefAsync<int> total = 0;
var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.LoginIp), x => x.LoginIp.Contains(input.LoginIp!))
.WhereIF(!string.IsNullOrEmpty(input.LoginUser), x => x.LoginUser!.Contains(input.LoginUser!))
.WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
.ToPageListAsync(input.PageNum, input.PageSize, total);
return new PagedResultDto<LoginLogGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
}
[NonAction]
public override Task<LoginLogGetListOutputDto> UpdateAsync(long id, LoginLogGetListOutputDto input)
{
return base.UpdateAsync(id, input);
}
}
}

View File

@@ -1,8 +1,8 @@
using SqlSugar; using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos; using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services; using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Furion.Application.Rbac.Dtos.Menu;
using Yi.Furion.Application.Rbac.Services; using Yi.Furion.Application.Rbac.Services;
using Yi.Furion.Core.Rbac.Dtos.Menu;
using Yi.Furion.Core.Rbac.Entities; using Yi.Furion.Core.Rbac.Entities;
namespace Yi.Furion.Application.Rbac.Services.Impl namespace Yi.Furion.Application.Rbac.Services.Impl

View File

@@ -1,7 +1,7 @@
using SqlSugar; using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos; using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services; using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Furion.Application.Rbac.Dtos.Post; using Yi.Furion.Core.Rbac.Dtos.Post;
using Yi.Furion.Core.Rbac.Entities; using Yi.Furion.Core.Rbac.Entities;
namespace Yi.Furion.Application.Rbac.Services.Impl namespace Yi.Furion.Application.Rbac.Services.Impl

View File

@@ -2,7 +2,7 @@ using SqlSugar;
using Yi.Framework.Infrastructure.Ddd.Dtos; using Yi.Framework.Infrastructure.Ddd.Dtos;
using Yi.Framework.Infrastructure.Ddd.Services; using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Furion.Application.Rbac.Domain; using Yi.Furion.Application.Rbac.Domain;
using Yi.Furion.Application.Rbac.Dtos.Role; using Yi.Furion.Core.Rbac.Dtos.Role;
using Yi.Furion.Core.Rbac.Entities; using Yi.Furion.Core.Rbac.Entities;
namespace Yi.Furion.Application.Rbac.Services.Impl namespace Yi.Furion.Application.Rbac.Services.Impl

View File

@@ -5,8 +5,8 @@ using Yi.Framework.Infrastructure.Ddd.Services;
using Yi.Framework.Infrastructure.Exceptions; using Yi.Framework.Infrastructure.Exceptions;
using Yi.Framework.Module.OperLogManager; using Yi.Framework.Module.OperLogManager;
using Yi.Furion.Application.Rbac.Domain; using Yi.Furion.Application.Rbac.Domain;
using Yi.Furion.Application.Rbac.Dtos.User; using Yi.Furion.Core.Rbac.Consts;
using Yi.Furion.Core.Rbac.ConstClasses; using Yi.Furion.Core.Rbac.Dtos.User;
using Yi.Furion.Core.Rbac.Entities; using Yi.Furion.Core.Rbac.Entities;
using Yi.Furion.Sqlsugar.Core.Repositories; using Yi.Furion.Sqlsugar.Core.Repositories;

View File

@@ -27,8 +27,4 @@
<ProjectReference Include="..\Yi.Furion.Sqlsugar.Core\Yi.Furion.Sqlsugar.Core.csproj" /> <ProjectReference Include="..\Yi.Furion.Sqlsugar.Core\Yi.Furion.Sqlsugar.Core.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Bbs\" />
</ItemGroup>
</Project> </Project>

View File

@@ -4,6 +4,195 @@
<name>Yi.Furion.Application</name> <name>Yi.Furion.Application</name>
</assembly> </assembly>
<members> <members>
<member name="T:Yi.Furion.Application.Bbs.Domain.ForumManager">
<summary>
论坛模块的领域服务
</summary>
</member>
<member name="T:Yi.Furion.Application.Bbs.Services.IArticleService">
<summary>
Article服务抽象
</summary>
</member>
<member name="T:Yi.Furion.Application.Bbs.Services.IBannerService">
<summary>
Banner抽象
</summary>
</member>
<member name="T:Yi.Furion.Application.Bbs.Services.ICommentService">
<summary>
Comment服务抽象
</summary>
</member>
<member name="T:Yi.Furion.Application.Bbs.Services.IDiscussService">
<summary>
Discuss服务抽象
</summary>
</member>
<member name="T:Yi.Furion.Application.Bbs.Services.ILabelService">
<summary>
Label服务抽象
</summary>
</member>
<member name="T:Yi.Furion.Application.Bbs.Services.Impl.AgreeService">
<summary>
点赞功能
</summary>
</member>
<member name="M:Yi.Furion.Application.Bbs.Services.Impl.AgreeService.PostOperateAsync(System.Int64)">
<summary>
点赞,返回true为点赞+1返回false为点赞-1
</summary>
<returns></returns>
</member>
<member name="T:Yi.Furion.Application.Bbs.Services.Impl.ArticleService">
<summary>
Article服务实现
</summary>
</member>
<member name="M:Yi.Furion.Application.Bbs.Services.Impl.ArticleService.GetAllAsync(System.Int64)">
<summary>
获取文章全部平铺信息
</summary>
<param name="discussId"></param>
<returns></returns>
<exception cref="T:Yi.Framework.Infrastructure.Exceptions.UserFriendlyException"></exception>
</member>
<member name="M:Yi.Furion.Application.Bbs.Services.Impl.ArticleService.GetDiscussIdAsync(System.Int64)">
<summary>
查询文章
</summary>
<param name="discussId"></param>
<returns></returns>
<exception cref="T:Yi.Framework.Infrastructure.Exceptions.UserFriendlyException"></exception>
</member>
<member name="M:Yi.Furion.Application.Bbs.Services.Impl.ArticleService.CreateAsync(Yi.Furion.Core.Bbs.Dtos.Article.ArticleCreateInputVo)">
<summary>
发表文章
</summary>
<param name="input"></param>
<returns></returns>
<exception cref="T:Yi.Framework.Infrastructure.Exceptions.UserFriendlyException"></exception>
</member>
<member name="M:Yi.Furion.Application.Bbs.Services.Impl.ArticleService.VerifyDiscussCreateIdAsync(System.Nullable{System.Int64})">
<summary>
效验创建权限
</summary>
<param name="userId"></param>
<returns></returns>
</member>
<member name="T:Yi.Furion.Application.Bbs.Services.Impl.BannerService">
<summary>
Banner服务实现
</summary>
</member>
<member name="T:Yi.Furion.Application.Bbs.Services.Impl.CommentService">
<summary>
评论
</summary>
</member>
<member name="M:Yi.Furion.Application.Bbs.Services.Impl.CommentService.GetDiscussIdAsync(System.Int64,Yi.Furion.Core.Bbs.Dtos.Comment.CommentGetListInputVo)">
<summary>
获取改主题下的评论,结构为二维列表,该查询无分页
</summary>
<param name="discussId"></param>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Application.Bbs.Services.Impl.CommentService.CreateAsync(Yi.Furion.Core.Bbs.Dtos.Comment.CommentCreateInputVo)">
<summary>
发表评论
</summary>
<param name="input"></param>
<returns></returns>
<exception cref="T:Yi.Framework.Infrastructure.Exceptions.UserFriendlyException"></exception>
</member>
<member name="T:Yi.Furion.Application.Bbs.Services.Impl.DiscussService">
<summary>
Discuss应用服务实现,用于参数效验、领域服务业务组合、日志记录、事务处理、账户信息
</summary>
</member>
<member name="M:Yi.Furion.Application.Bbs.Services.Impl.DiscussService.GetAsync(System.Int64)">
<summary>
单查
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Application.Bbs.Services.Impl.DiscussService.GetListAsync(Yi.Furion.Core.Bbs.Dtos.Discuss.DiscussGetListInputVo)">
<summary>
查询
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Application.Bbs.Services.Impl.DiscussService.CreateAsync(Yi.Furion.Core.Bbs.Dtos.Discuss.DiscussCreateInputVo)">
<summary>
创建主题
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Application.Bbs.Services.Impl.DiscussService.VerifyDiscussPermissionAsync(System.Int64)">
<summary>
效验主题查询权限
</summary>
<param name="discussId"></param>
<returns></returns>
<exception cref="T:Yi.Framework.Infrastructure.Exceptions.UserFriendlyException"></exception>
</member>
<member name="T:Yi.Furion.Application.Bbs.Services.Impl.MyTypeService">
<summary>
Label服务实现
</summary>
</member>
<member name="M:Yi.Furion.Application.Bbs.Services.Impl.MyTypeService.GetListCurrentAsync(Yi.Furion.Core.Bbs.Dtos.MyType.MyTypeGetListInputVo)">
<summary>
获取当前用户的主题类型
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:Yi.Furion.Application.Bbs.Services.Impl.MyTypeService.CreateAsync(Yi.Furion.Core.Bbs.Dtos.MyType.MyTypeCreateInputVo)">
<summary>
创建
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="T:Yi.Furion.Application.Bbs.Services.Impl.PlateService">
<summary>
Plate服务实现
</summary>
</member>
<member name="T:Yi.Furion.Application.Bbs.Services.Impl.SettingService">
<summary>
Setting服务实现
</summary>
</member>
<member name="M:Yi.Furion.Application.Bbs.Services.Impl.SettingService.GetTitleAsync">
<summary>
获取配置标题
</summary>
<returns></returns>
<exception cref="T:System.NotImplementedException"></exception>
</member>
<member name="T:Yi.Furion.Application.Bbs.Services.IPlateService">
<summary>
Plate服务抽象
</summary>
</member>
<member name="T:Yi.Furion.Application.Bbs.Services.ISettingService">
<summary>
Setting应用抽象
</summary>
</member>
<member name="M:Yi.Furion.Application.Bbs.Services.ISettingService.GetTitleAsync">
<summary>
获取配置标题
</summary>
<returns></returns>
</member>
<member name="T:Yi.Furion.Application.Rbac.Domain.AccountManager"> <member name="T:Yi.Furion.Application.Rbac.Domain.AccountManager">
<summary> <summary>
用户领域服务 用户领域服务
@@ -75,56 +264,6 @@
<param name="postIds"></param> <param name="postIds"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="P:Yi.Furion.Application.Rbac.Dtos.Account.RegisterDto.UserName">
<summary>
账号
</summary>
</member>
<member name="P:Yi.Furion.Application.Rbac.Dtos.Account.RegisterDto.Password">
<summary>
密码
</summary>
</member>
<member name="P:Yi.Furion.Application.Rbac.Dtos.Account.RegisterDto.Uuid">
<summary>
唯一标识码
</summary>
</member>
<member name="P:Yi.Furion.Application.Rbac.Dtos.Account.RegisterDto.Phone">
<summary>
电话
</summary>
</member>
<member name="P:Yi.Furion.Application.Rbac.Dtos.Account.RegisterDto.Code">
<summary>
验证码
</summary>
</member>
<member name="T:Yi.Furion.Application.Rbac.Dtos.Dept.DeptCreateInputVo">
<summary>
Dept输入创建对象
</summary>
</member>
<member name="T:Yi.Furion.Application.Rbac.Dtos.Menu.MenuCreateInputVo">
<summary>
Menu输入创建对象
</summary>
</member>
<member name="T:Yi.Furion.Application.Rbac.Dtos.Post.PostCreateInputVo">
<summary>
Post输入创建对象
</summary>
</member>
<member name="T:Yi.Furion.Application.Rbac.Dtos.Role.RoleCreateInputVo">
<summary>
Role输入创建对象
</summary>
</member>
<member name="T:Yi.Furion.Application.Rbac.Dtos.User.UserCreateInputVo">
<summary>
User输入创建对象
</summary>
</member>
<member name="M:Yi.Furion.Application.Rbac.Event.LoginEventHandler.GetClientInfo(Microsoft.AspNetCore.Http.HttpContext)"> <member name="M:Yi.Furion.Application.Rbac.Event.LoginEventHandler.GetClientInfo(Microsoft.AspNetCore.Http.HttpContext)">
<summary> <summary>
获取客户端信息 获取客户端信息
@@ -139,6 +278,11 @@
<param name="context"></param> <param name="context"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:Yi.Furion.Application.Rbac.Services.IConfigService">
<summary>
Config服务抽象
</summary>
</member>
<member name="T:Yi.Furion.Application.Rbac.Services.IDeptService"> <member name="T:Yi.Furion.Application.Rbac.Services.IDeptService">
<summary> <summary>
Dept服务抽象 Dept服务抽象
@@ -149,17 +293,17 @@
Menu服务抽象 Menu服务抽象
</summary> </summary>
</member> </member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.AccountService.ValidationImageCaptcha(Yi.Furion.Application.Rbac.Dtos.Account.LoginInputVo)"> <member name="M:Yi.Furion.Application.Rbac.Services.Impl.AccountService.ValidationImageCaptcha(Yi.Furion.Core.Rbac.Dtos.Account.LoginInputVo)">
<summary> <summary>
效验图片登录验证码,无需和账号绑定 效验图片登录验证码,无需和账号绑定
</summary> </summary>
</member> </member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.AccountService.ValidationPhoneCaptcha(Yi.Furion.Application.Rbac.Dtos.Account.RegisterDto)"> <member name="M:Yi.Furion.Application.Rbac.Services.Impl.AccountService.ValidationPhoneCaptcha(Yi.Furion.Core.Rbac.Dtos.Account.RegisterDto)">
<summary> <summary>
效验电话验证码,需要与电话号码绑定 效验电话验证码,需要与电话号码绑定
</summary> </summary>
</member> </member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.AccountService.PostLoginAsync(Yi.Furion.Application.Rbac.Dtos.Account.LoginInputVo)"> <member name="M:Yi.Furion.Application.Rbac.Services.Impl.AccountService.PostLoginAsync(Yi.Furion.Core.Rbac.Dtos.Account.LoginInputVo)">
<summary> <summary>
登录 登录
</summary> </summary>
@@ -178,13 +322,13 @@
</summary> </summary>
<param name="str_handset"></param> <param name="str_handset"></param>
</member> </member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.AccountService.PostCaptchaPhone(Yi.Furion.Application.Rbac.Dtos.Account.PhoneCaptchaImageDto)"> <member name="M:Yi.Furion.Application.Rbac.Services.Impl.AccountService.PostCaptchaPhone(Yi.Furion.Core.Rbac.Dtos.Account.PhoneCaptchaImageDto)">
<summary> <summary>
注册 手机验证码 注册 手机验证码
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.AccountService.PostRegisterAsync(Yi.Furion.Application.Rbac.Dtos.Account.RegisterDto)"> <member name="M:Yi.Furion.Application.Rbac.Services.Impl.AccountService.PostRegisterAsync(Yi.Furion.Core.Rbac.Dtos.Account.RegisterDto)">
<summary> <summary>
注册,需要验证码通过 注册,需要验证码通过
</summary> </summary>
@@ -210,14 +354,14 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.AccountService.UpdatePasswordAsync(Yi.Furion.Application.Rbac.Dtos.Account.UpdatePasswordDto)"> <member name="M:Yi.Furion.Application.Rbac.Services.Impl.AccountService.UpdatePasswordAsync(Yi.Furion.Core.Rbac.Dtos.Account.UpdatePasswordDto)">
<summary> <summary>
更新密码 更新密码
</summary> </summary>
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.AccountService.RestPasswordAsync(System.Int64,Yi.Furion.Application.Rbac.Dtos.Account.RestPasswordDto)"> <member name="M:Yi.Furion.Application.Rbac.Services.Impl.AccountService.RestPasswordAsync(System.Int64,Yi.Furion.Core.Rbac.Dtos.Account.RestPasswordDto)">
<summary> <summary>
重置密码 重置密码
</summary> </summary>
@@ -225,13 +369,25 @@
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.AccountService.UpdateIconAsync(Yi.Furion.Application.Rbac.Dtos.Account.UpdateIconDto)"> <member name="M:Yi.Furion.Application.Rbac.Services.Impl.AccountService.UpdateIconAsync(Yi.Furion.Core.Rbac.Dtos.Account.UpdateIconDto)">
<summary> <summary>
更新头像 更新头像
</summary> </summary>
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="T:Yi.Furion.Application.Rbac.Services.Impl.ConfigService">
<summary>
Config服务实现
</summary>
</member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.ConfigService.GetListAsync(Yi.Furion.Core.Rbac.Dtos.Config.ConfigGetListInputVo)">
<summary>
多查
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="T:Yi.Furion.Application.Rbac.Services.Impl.DeptService"> <member name="T:Yi.Furion.Application.Rbac.Services.Impl.DeptService">
<summary> <summary>
Dept服务实现 Dept服务实现
@@ -243,7 +399,7 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.DeptService.GetListAsync(Yi.Furion.Application.Rbac.Dtos.Dept.DeptGetListInputVo)"> <member name="M:Yi.Furion.Application.Rbac.Services.Impl.DeptService.GetListAsync(Yi.Furion.Core.Rbac.Dtos.Dept.DeptGetListInputVo)">
<summary> <summary>
多查 多查
</summary> </summary>
@@ -272,14 +428,14 @@
Role服务实现 Role服务实现
</summary> </summary>
</member> </member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.RoleService.CreateAsync(Yi.Furion.Application.Rbac.Dtos.Role.RoleCreateInputVo)"> <member name="M:Yi.Furion.Application.Rbac.Services.Impl.RoleService.CreateAsync(Yi.Furion.Core.Rbac.Dtos.Role.RoleCreateInputVo)">
<summary> <summary>
添加角色 添加角色
</summary> </summary>
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.RoleService.UpdateAsync(System.Int64,Yi.Furion.Application.Rbac.Dtos.Role.RoleUpdateInputVo)"> <member name="M:Yi.Furion.Application.Rbac.Services.Impl.RoleService.UpdateAsync(System.Int64,Yi.Furion.Core.Rbac.Dtos.Role.RoleUpdateInputVo)">
<summary> <summary>
修改角色 修改角色
</summary> </summary>
@@ -300,14 +456,14 @@
User服务实现 User服务实现
</summary> </summary>
</member> </member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.UserService.GetListAsync(Yi.Furion.Application.Rbac.Dtos.User.UserGetListInputVo)"> <member name="M:Yi.Furion.Application.Rbac.Services.Impl.UserService.GetListAsync(Yi.Furion.Core.Rbac.Dtos.User.UserGetListInputVo)">
<summary> <summary>
查询用户 查询用户
</summary> </summary>
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.UserService.CreateAsync(Yi.Furion.Application.Rbac.Dtos.User.UserCreateInputVo)"> <member name="M:Yi.Furion.Application.Rbac.Services.Impl.UserService.CreateAsync(Yi.Furion.Core.Rbac.Dtos.User.UserCreateInputVo)">
<summary> <summary>
添加用户 添加用户
</summary> </summary>
@@ -322,7 +478,7 @@
<param name="id"></param> <param name="id"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.UserService.UpdateAsync(System.Int64,Yi.Furion.Application.Rbac.Dtos.User.UserUpdateInputVo)"> <member name="M:Yi.Furion.Application.Rbac.Services.Impl.UserService.UpdateAsync(System.Int64,Yi.Furion.Core.Rbac.Dtos.User.UserUpdateInputVo)">
<summary> <summary>
更新用户 更新用户
</summary> </summary>
@@ -330,7 +486,7 @@
<param name="input"></param> <param name="input"></param>
<returns></returns> <returns></returns>
</member> </member>
<member name="M:Yi.Furion.Application.Rbac.Services.Impl.UserService.UpdateProfileAsync(Yi.Furion.Application.Rbac.Dtos.User.ProfileUpdateInputVo)"> <member name="M:Yi.Furion.Application.Rbac.Services.Impl.UserService.UpdateProfileAsync(Yi.Furion.Core.Rbac.Dtos.User.ProfileUpdateInputVo)">
<summary> <summary>
更新个人中心 更新个人中心
</summary> </summary>

View File

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

View File

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

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Core.Bbs.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.Furion.Core.Bbs.Consts
{
/// <summary>
/// 常量定义
/// </summary>
public class PlateConst
{
public const string = "传入的板块id不存在";
}
}

View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Core.Bbs.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,18 @@
using System.Collections.Generic;
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Furion.Core.Bbs.Dtos.Article
{
public class ArticleAllOutputDto : IEntityDto<long>
{
public long Id { get; set; }
//批量查询,不给内容,性能考虑
//public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public long 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.Furion.Core.Bbs.Dtos.Article
{
/// <summary>
/// Article输入创建对象
/// </summary>
public class ArticleCreateInputVo
{
public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public long ParentId { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Infrastructure.Ddd.Dtos;
namespace Yi.Furion.Core.Bbs.Dtos.Article
{
public class ArticleGetListInputVo : PagedAndSortedResultRequestDto
{
public long Id { get; set; }
public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public long ParentId { get; set; }
}
}

View File

@@ -0,0 +1,16 @@
using System.Collections.Generic;
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Furion.Core.Bbs.Dtos.Article
{
public class ArticleGetListOutputDto : IEntityDto<long>
{
public long Id { 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 Name { get; set; }
public long DiscussId { get; set; }
public List<ArticleGetListOutputDto> Children { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Furion.Core.Bbs.Dtos.Article
{
public class ArticleGetOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public long ParentId { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace Yi.Furion.Core.Bbs.Dtos.Article
{
public class ArticleUpdateInputVo
{
public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public long ParentId { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Core.Bbs.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 Yi.Framework.Infrastructure.Ddd.Dtos;
namespace Yi.Furion.Core.Bbs.Dtos.Banner
{
public class BannerGetListInputVo : PagedAndSortedResultRequestDto
{
public string Name { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Furion.Core.Bbs.Dtos.Banner
{
public class BannerGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
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,15 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Furion.Core.Bbs.Dtos.Banner
{
public class BannerGetOutputDto : IEntityDto<long>
{
public long Id { get; set; }
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.Furion.Core.Bbs.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,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
namespace Yi.Furion.Core.Bbs.Dtos.Comment
{
/// <summary>
/// Comment输入创建对象
/// </summary>
public class CommentCreateInputVo
{
/// <summary>
/// 评论id
/// </summary>
public string Content { get; set; }
/// <summary>
/// 主题id
/// </summary>
public long DiscussId { get; set; }
/// <summary>
/// 第一层评论id第一层为0
/// </summary>
public long RootId { get; set; }
/// <summary>
/// 被回复的CommentId第一层为0
/// </summary>
public long ParentId { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using System;
namespace Yi.Furion.Core.Bbs.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 long? DiscussId { get; set; }
}
}

View File

@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
using Yi.Furion.Core.Rbac.Dtos.User;
namespace Yi.Furion.Core.Bbs.Dtos.Comment
{
/// <summary>
/// <20><><EFBFBD>۶෴
/// </summary>
public class CommentGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public DateTime? CreationTime { get; set; }
public string Content { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD>id
/// </summary>
public long DiscussId { get; set; }
public long ParentId { get; set; }
public long 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,36 @@
using System;
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
using Yi.Furion.Core.Rbac.Dtos.User;
namespace Yi.Furion.Core.Bbs.Dtos.Comment
{
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD><D8A3><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۼ<EFBFBD><DBBC><EFBFBD>
/// </summary>
public class CommentGetOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public DateTime? CreateTime { get; set; }
public string Content { get; set; }
public long 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 long RootId { get; set; }
/// <summary>
/// <20><><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>CommentId
/// </summary>
public long ParentId { get; set; }
}
}

View File

@@ -0,0 +1,10 @@
namespace Yi.Furion.Core.Bbs.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,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; }
//Ĭ<>ϲ<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,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>
/// <20>Ƿ<EFBFBD><C7B7>ѵ<EFBFBD><D1B5><EFBFBD>
/// </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; }
//<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 long 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<long> PermissionUserIds { get; set; }
public UserGetListOutputDto User { get; set; }
public void SetBan()
{
Title = DiscussConst.˽<EFBFBD><EFBFBD>;
Introduction = "";
Cover = null;
//<2F><><EFBFBD><EFBFBD>ֹ
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:
//<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,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; }
//<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<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>
/// <20><><EFBFBD><EFBFBD>
/// </summary>
public string Cover { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Core.Bbs.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,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Infrastructure.Ddd.Dtos;
namespace Yi.Furion.Core.Bbs.Dtos.MyType
{
public class MyTypeGetListInputVo : PagedAndSortedResultRequestDto
{
public long Id { get; set; }
public string Name { get; set; }
public string Color { get; set; }
public string BackgroundColor { get; set; }
public long UserId { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Furion.Core.Bbs.Dtos.MyType
{
public class MyTypeGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public string Name { get; set; }
public string Color { get; set; }
public string BackgroundColor { get; set; }
public long UserId { get; set; }
}
}

View File

@@ -0,0 +1,13 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Furion.Core.Bbs.Dtos.MyType
{
public class MyTypeOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public string Name { get; set; }
public string Color { get; set; }
public string BackgroundColor { get; set; }
public long UserId { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Core.Bbs.Dtos.MyType
{
public class MyTypeUpdateInputVo
{
public long Id { get; set; }
public string Name { get; set; }
public string Color { get; set; }
public string BackgroundColor { get; set; }
public long UserId { 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.Furion.Core.Bbs.Dtos.Plate
{
/// <summary>
/// Plate输入创建对象
/// </summary>
public class PlateCreateInputVo
{
public long Id { get; set; }
public string Name { get; set; }
public string Logo { get; set; }
public string Introduction { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using Yi.Framework.Infrastructure.Ddd.Dtos;
namespace Yi.Furion.Core.Bbs.Dtos.Plate
{
public class PlateGetListInputVo : PagedAndSortedResultRequestDto
{
public long Id { get; set; }
public string Name { get; set; }
public string Logo { get; set; }
public string Introduction { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Furion.Core.Bbs.Dtos.Plate
{
public class PlateGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public string Name { get; set; }
public string Logo { get; set; }
public string Introduction { get; set; }
}
}

View File

@@ -0,0 +1,12 @@
using Yi.Framework.Infrastructure.Ddd.Dtos.Abstract;
namespace Yi.Furion.Core.Bbs.Dtos.Plate
{
public class PlateGetOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public string Name { get; set; }
public string Logo { get; set; }
public string Introduction { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Core.Bbs.Dtos.Plate
{
public class PlateUpdateInputVo
{
public long Id { get; set; }
public string Name { get; set; }
public string Logo { get; set; }
public string Introduction { get; set; }
}
}

View File

@@ -0,0 +1,35 @@
using System;
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Auditing;
using Yi.Framework.Infrastructure.Ddd.Entities;
using Yi.Framework.Infrastructure.Helper;
namespace Yi.Furion.Core.Bbs.Entities
{
[SugarTable("Agree")]
public class AgreeEntity : IEntity<long>, ICreationAuditedObject
{
public AgreeEntity()
{
}
public AgreeEntity(long discussId)
{
DiscussId = discussId;
}
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; } = SnowflakeHelper.NextId;
public DateTime CreationTime { get; set; }
/// <summary>
/// 主题id
/// </summary>
public long DiscussId { get; set; }
/// <summary>
/// 创建者
/// </summary>
public long? CreatorId { get; set; }
}
}

View File

@@ -0,0 +1,58 @@
using System.Collections.Generic;
using System.Linq;
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Entities;
using Yi.Framework.Infrastructure.Ddd.Entities;
namespace Yi.Furion.Core.Bbs.Entities
{
[SugarTable("Article")]
public class ArticleEntity : IEntity<long>, ISoftDelete
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
public bool IsDeleted { get; set; }
[SugarColumn(Length = 999999)]
public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public long 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,26 @@
using System;
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Auditing;
using Yi.Framework.Infrastructure.Data.Entities;
using Yi.Framework.Infrastructure.Ddd.Entities;
namespace Yi.Furion.Core.Bbs.Entities
{
[SugarTable("Banner")]
public class BannerEntity : IEntity<long>, ISoftDelete, IAuditedObject
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; 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 long? CreatorId { get; set; }
public long? LastModifierId { get; set; }
public DateTime? LastModificationTime { get; set; }
}
}

View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Auditing;
using Yi.Framework.Infrastructure.Data.Entities;
using Yi.Framework.Infrastructure.Ddd.Entities;
using Yi.Furion.Core.Rbac.Entities;
namespace Yi.Furion.Core.Bbs.Entities
{
/// <summary>
/// 评论表
/// </summary>
[SugarTable("Comment")]
public class CommentEntity : IEntity<long>, ISoftDelete, IAuditedObject
{
/// <summary>
/// 采用二维数组方式,不使用树形方式
/// </summary>
public CommentEntity()
{
}
public CommentEntity(long discussId)
{
DiscussId = discussId;
}
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
public bool IsDeleted { get; set; }
public string Content { get; set; }
public long DiscussId { get; set; }
/// <summary>
/// 被回复的CommentId
/// </summary>
public long ParentId { get; set; }
public DateTime CreationTime { get; set; }
public long 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 long? CreatorId { get; set; }
public long? LastModifierId { get; set; }
public DateTime? LastModificationTime { get; set; }
}
}

View File

@@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Auditing;
using Yi.Framework.Infrastructure.Data.Entities;
using Yi.Framework.Infrastructure.Ddd.Entities;
using Yi.Furion.Core.Bbs.Enums;
namespace Yi.Furion.Core.Bbs.Entities
{
[SugarTable("Discuss")]
public class DiscussEntity : IEntity<long>, ISoftDelete, IAuditedObject
{
public DiscussEntity()
{
}
public DiscussEntity(long plateId)
{
PlateId = plateId;
}
[SugarColumn(IsPrimaryKey = true)]
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; }
/// <summary>
/// 封面
/// </summary>
public string Cover { get; set; }
[SugarColumn(Length = 999999)]
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 long PlateId { get; set; }
public DateTime CreationTime { get; set; }
public long? CreatorId { get; set; }
public long? LastModifierId { get; set; }
public DateTime? LastModificationTime { get; set; }
/// <summary>
/// 当PermissionType为部分用户时候以下列表中的用户+创建者 代表拥有权限
/// </summary>
[SugarColumn(IsJson = true)]//使用json处理
public List<long> PermissionUserIds { get; set; }
}
}

View File

@@ -0,0 +1,21 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Infrastructure.Ddd.Entities;
namespace Yi.Furion.Core.Bbs.Entities
{
[SugarTable("DiscussMyType")]
public class DiscussMyTypeEntity : IEntity<long>
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
public long DiscussId { get; set; }
public long MyTypeId { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Entities;
using Yi.Framework.Infrastructure.Ddd.Entities;
namespace Yi.Furion.Core.Bbs.Entities
{
[SugarTable("MyType")]
public class MyTypeEntity : IEntity<long>, ISoftDelete
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; }
public bool IsDeleted { get; set; }
public string Name { get; set; }
public string Color { get; set; }
public string BackgroundColor { get; set; }
public long UserId { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using SqlSugar;
using Yi.Framework.Infrastructure.Data.Entities;
using Yi.Framework.Infrastructure.Ddd.Entities;
namespace Yi.Furion.Core.Bbs.Entities
{
[SugarTable("Plate")]
public class PlateEntity : IEntity<long>, ISoftDelete
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; 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 Yi.Framework.Infrastructure.Ddd.Entities;
namespace Yi.Furion.Core.Bbs.Entities
{
[SugarTable("Setting")]
public class SettingEntity : IEntity<long>
{
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; 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,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.Furion.Core.Bbs.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.Furion.Core.Bbs.Enums
{
public enum QueryDiscussTypeEnum
{
New,
Suggest,
Host
}
}

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Furion.EventBus;
using Yi.Furion.Core.Rbac.Etos;
namespace Yi.Furion.Core.Bbs.Etos
{
public class SeeDiscussEventSource : IEventSource
{
public SeeDiscussEventSource(SeeDiscussEventArgs payload)
{ Payload = payload; }
public string EventId => nameof(SeeDiscussEventSource);
public DateTime CreatedTime { get; set; } = DateTime.UtcNow;
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public CancellationToken CancellationToken { get; set; }
public object Payload { get; set; }
}
public class SeeDiscussEventArgs
{
public long DiscussId { get; set; }
public int OldSeeNum { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
global using Furion;
global using Furion.DatabaseAccessor;
global using Furion.DataEncryption;
global using Furion.DataValidation;
global using Furion.DependencyInjection;
global using Furion.DynamicApiController;
global using Furion.Extensions;
global using Furion.FriendlyException;
global using Furion.Logging;
global using Mapster;
global using Microsoft.AspNetCore.Authorization;
global using Microsoft.AspNetCore.Http;
global using Microsoft.AspNetCore.Mvc;
global using Microsoft.CodeAnalysis;
global using System.ComponentModel.DataAnnotations;
global using System;
global using System.Collections.Generic;

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Furion.Core.Rbac.ConstClasses namespace Yi.Furion.Core.Rbac.Consts
{ {
/// <summary> /// <summary>
/// 常量定义 /// 常量定义

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Furion.Core.Rbac.ConstClasses namespace Yi.Furion.Core.Rbac.Consts
{ {
/// <summary> /// <summary>
/// 常量定义 /// 常量定义

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Furion.Core.Rbac.ConstClasses namespace Yi.Furion.Core.Rbac.Consts
{ {
/// <summary> /// <summary>
/// 常量定义 /// 常量定义

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Furion.Core.Rbac.ConstClasses namespace Yi.Furion.Core.Rbac.Consts
{ {
/// <summary> /// <summary>
/// 常量定义 /// 常量定义

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Furion.Core.Rbac.ConstClasses namespace Yi.Furion.Core.Rbac.Consts
{ {
/// <summary> /// <summary>
/// 常量定义 /// 常量定义

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Furion.Application.Rbac.Dtos.Account namespace Yi.Furion.Core.Rbac.Dtos.Account
{ {
public class CaptchaImageDto public class CaptchaImageDto
{ {

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Furion.Application.Rbac.Dtos.Account namespace Yi.Furion.Core.Rbac.Dtos.Account
{ {
public class LoginInputVo public class LoginInputVo
{ {

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Furion.Application.Rbac.Dtos.Account namespace Yi.Furion.Core.Rbac.Dtos.Account
{ {
public class PhoneCaptchaImageDto public class PhoneCaptchaImageDto
{ {

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Yi.Furion.Application.Rbac.Dtos.Account namespace Yi.Furion.Core.Rbac.Dtos.Account
{ {
public class RegisterDto public class RegisterDto
{ {

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