diff --git a/Yi.Framework.Net6/src/project/BBS/GlobalUsings.cs b/Yi.Framework.Net6/src/project/BBS/GlobalUsings.cs deleted file mode 100644 index d6ecb816..00000000 --- a/Yi.Framework.Net6/src/project/BBS/GlobalUsings.cs +++ /dev/null @@ -1,4 +0,0 @@ -global using Yi.Framework.Core.Attributes; -global using Yi.Framework.Core.Helper; -global using Yi.Framework.Core.Model; -global using Yi.Framework.Core.Exceptions; \ No newline at end of file diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/Exhibition/Dtos/Argee/AgreeDto.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/Exhibition/Dtos/Argee/AgreeDto.cs deleted file mode 100644 index a2a1465d..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/Exhibition/Dtos/Argee/AgreeDto.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.BBS.Application.Contracts.Exhibition.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; } - } -} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/Yi.BBS.Application.Contracts.csproj b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/Yi.BBS.Application.Contracts.csproj deleted file mode 100644 index 260aff7a..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/Yi.BBS.Application.Contracts.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - net6.0 - enable - enable - True - ./$(AssemblyName)SwaggerDoc.xml - - - - - - - - - - - Always - - - - diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/YiBBSApplicationContractsModule.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/YiBBSApplicationContractsModule.cs deleted file mode 100644 index d968104f..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application.Contracts/YiBBSApplicationContractsModule.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using StartupModules; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Core.Attributes; -using Yi.BBS.Domain.Shared; - -namespace Yi.BBS.Application.Contracts -{ - [DependsOn( - typeof(YiBBSDomainSharedModule) - )] - public class YiBBSApplicationContractsModule : IStartupModule - { - public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) - { - } - - public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) - { - } - } -} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/Exhibition/AgreeService.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/Exhibition/AgreeService.cs deleted file mode 100644 index fb41f751..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/Exhibition/AgreeService.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Cike.AutoWebApi.Setting; -using Yi.BBS.Application.Contracts.Exhibition.Dtos.Argee; -using Yi.BBS.Domain.Exhibition.Entities; -using Yi.BBS.Domain.Forum.Entities; -using Yi.Framework.Core.CurrentUsers; -using Yi.Framework.Ddd.Repositories; -using Yi.Framework.Ddd.Services; -using Yi.Framework.Ddd.Services.Abstract; -using Yi.Framework.Uow; - -namespace Yi.BBS.Application.Exhibition -{ - /// - /// 点赞功能 - /// - [AppService] - public class AgreeService : ApplicationService, IApplicationService, IAutoApiService - { - - [Autowired] - private IRepository _repository { get; set; } - - [Autowired] - private IRepository _discssRepository { get; set; } - [Autowired] - private ICurrentUser _currentUser { get; set; } - - [Autowired] - private IUnitOfWorkManager _unitOfWorkManager { get; set; } - - /// - /// 点赞,返回true为点赞+1,返回false为点赞-1 - /// - /// - public async Task PostOperateAsync(long discussId) - { - var entity = await _repository.GetFirstAsync(x => x.DiscussId == discussId && x.CreatorId == _currentUser.Id); - //判断是否已经点赞过 - if (entity is null) - { - using (var uow = _unitOfWorkManager.CreateContext()) - { - //没点赞过,添加记录即可,,修改总点赞数量 - 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); - uow.Commit(); - } - return new AgreeDto(true); - - } - else - { - using (var uow = _unitOfWorkManager.CreateContext()) - { - //点赞过,删除即可,修改总点赞数量 - 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); - uow.Commit(); - } - - return new AgreeDto(false); - } - } - } -} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/Yi.BBS.Application.csproj b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/Yi.BBS.Application.csproj deleted file mode 100644 index 71a2b0ec..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/Yi.BBS.Application.csproj +++ /dev/null @@ -1,26 +0,0 @@ - - - - net6.0 - enable - enable - True - ./$(AssemblyName)SwaggerDoc.xml - - - - - - - - - - - - - - Always - - - - diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/YiBBSApplicationModule.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/YiBBSApplicationModule.cs deleted file mode 100644 index 0f87fe5f..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Application/YiBBSApplicationModule.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using StartupModules; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.BBS.Application.Contracts; -using Yi.Framework.Auth.JwtBearer; -using Yi.Framework.Core.Attributes; -using Yi.Framework.Data; -using Yi.Framework.Ddd; -using Yi.BBS.Domain; -using Yi.RBAC.Application; - -namespace Yi.BBS.Application -{ - [DependsOn( - - typeof(YiBBSApplicationContractsModule), - typeof(YiBBSDomainModule), - typeof(YiFrameworkAuthJwtBearerModule), - typeof(YiRBACApplicationModule) - )] - public class YiBBSApplicationModule : IStartupModule - { - public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) - { - } - - public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) - { - } - } -} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain.Shared/Forum/EnumClasses/DiscussPermissionTypeEnum.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain.Shared/Forum/EnumClasses/DiscussPermissionTypeEnum.cs deleted file mode 100644 index 625a66a2..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain.Shared/Forum/EnumClasses/DiscussPermissionTypeEnum.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.BBS.Domain.Shared.Forum.EnumClasses -{ - public enum DiscussPermissionTypeEnum - { - /// - /// 默认:公开 - /// - Public = 0, - - /// - /// 仅自己可见 - /// - Oneself, - - /// - /// 部分用户可见 - /// - User - - } -} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain.Shared/Forum/Etos/SeeDiscussEventArgs.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain.Shared/Forum/Etos/SeeDiscussEventArgs.cs deleted file mode 100644 index 3381d4e0..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain.Shared/Forum/Etos/SeeDiscussEventArgs.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.BBS.Domain.Shared.Forum.Etos -{ - public class SeeDiscussEventArgs - { - public long DiscussId { get; set; } - public int OldSeeNum { get; set; } - } -} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain.Shared/Yi.BBS.Domain.Shared.csproj b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain.Shared/Yi.BBS.Domain.Shared.csproj deleted file mode 100644 index 692994fe..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain.Shared/Yi.BBS.Domain.Shared.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - net6.0 - enable - enable - - - - - - - - - diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain.Shared/YiBBSDomainSharedModule.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain.Shared/YiBBSDomainSharedModule.cs deleted file mode 100644 index 5f37e09e..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain.Shared/YiBBSDomainSharedModule.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using StartupModules; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Core.Attributes; -using Yi.Framework.Ddd; - -namespace Yi.BBS.Domain.Shared -{ - [DependsOn( - typeof(YiFrameworkDddModule) - )] - public class YiBBSDomainSharedModule : IStartupModule - { - public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) - { - } - - public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) - { - } - } -} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/DataSeeds/BbsConfigDataSeed.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/DataSeeds/BbsConfigDataSeed.cs deleted file mode 100644 index 1e4aac53..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/DataSeeds/BbsConfigDataSeed.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Data.DataSeeds; -using Yi.Framework.Ddd.Repositories; -using Yi.RBAC.Domain.Identity.Entities; -using Yi.RBAC.Domain.Setting.Entities; -using Yi.RBAC.Domain.Shared.Identity.EnumClasses; - -namespace Yi.BBS.Domain.DataSeed -{ - [AppService(typeof(IDataSeed))] - public class BbsConfigDataSeed : AbstractDataSeed - { - public BbsConfigDataSeed(IRepository repository) : base(repository) - { - } - - public override async Task IsInvoker() - { - return !await _repository.IsAnyAsync(x => x.ConfigKey == "bbs.site.name"); - } - public override List GetSeedData() - { - List entities = new List() - { - new ConfigEntity { Id = SnowflakeHelper.NextId, ConfigKey = "bbs.site.name", ConfigValue = "Yi意社区", ConfigName = "bbs站点名称" }, - new ConfigEntity { Id = SnowflakeHelper.NextId, ConfigKey = "bbs.site.author", ConfigValue = "橙子", ConfigName = "bbs站点作者" }, - new ConfigEntity { Id = SnowflakeHelper.NextId, ConfigKey = "bbs.site.icp", ConfigValue = "2023 意社区 | 赣ICP备xxxxxx号-4", ConfigName = "bbs备案号" }, - new ConfigEntity { Id = SnowflakeHelper.NextId, ConfigKey = "bbs.site.bottom", ConfigValue = "YiFramework意框架", ConfigName = "bbs底部信息" }, - }; - return entities; - } - } -} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/DataSeeds/BbsMenuDataSeed.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/DataSeeds/BbsMenuDataSeed.cs deleted file mode 100644 index 381192ca..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/DataSeeds/BbsMenuDataSeed.cs +++ /dev/null @@ -1,326 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Data.DataSeeds; -using Yi.Framework.Ddd.Repositories; -using Yi.RBAC.Domain.Identity.Entities; -using Yi.RBAC.Domain.Shared.Identity.EnumClasses; - -namespace Yi.BBS.Domain.DataSeed -{ - [AppService(typeof(IDataSeed))] - public class BbsMenuDataSeed : AbstractDataSeed - { - public BbsMenuDataSeed(IRepository repository) : base(repository) - { - } - - public override async Task IsInvoker() - { - return !await _repository.IsAnyAsync(x => x.MenuName == "BBS"); - } - public override List GetSeedData() - { - List entities = new List(); - - //BBS - MenuEntity bbs = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "BBS", - MenuType = MenuTypeEnum.Catalogue, - Router = "/bbs", - IsShow = true, - IsLink = false, - MenuIcon = "international", - OrderNum = 97, - ParentId = 0, - IsDeleted = false - }; - entities.Add(bbs); - - - //评论管理 - MenuEntity comment = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "评论管理", - PermissionCode = "bbs:comment:list", - MenuType = MenuTypeEnum.Menu, - Router = "comment", - IsShow = true, - IsLink = false, - IsCache = true, - Component = "bbs/comment/index", - MenuIcon = "education", - OrderNum = 100, - ParentId = bbs.Id, - IsDeleted = false - }; - entities.Add(comment); - - MenuEntity commentQuery = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "评论查询", - PermissionCode = "bbs:comment:query", - MenuType = MenuTypeEnum.Component, - OrderNum = 100, - ParentId = comment.Id, - IsDeleted = false - }; - entities.Add(commentQuery); - - MenuEntity commentAdd = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "评论新增", - PermissionCode = "bbs:comment:add", - MenuType = MenuTypeEnum.Component, - OrderNum = 100, - ParentId = comment.Id, - IsDeleted = false - }; - entities.Add(commentAdd); - - MenuEntity commentEdit = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "评论修改", - PermissionCode = "bbs:comment:edit", - MenuType = MenuTypeEnum.Component, - OrderNum = 100, - ParentId = comment.Id, - IsDeleted = false - }; - entities.Add(commentEdit); - - MenuEntity commentRemove = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "评论删除", - PermissionCode = "bbs:comment:remove", - MenuType = MenuTypeEnum.Component, - OrderNum = 100, - ParentId = comment.Id, - IsDeleted = false - }; - entities.Add(commentRemove); - - - //文章管理 - MenuEntity article = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "文章管理", - PermissionCode = "bbs:article:list", - MenuType = MenuTypeEnum.Menu, - Router = "article", - IsShow = true, - IsLink = false, - IsCache = true, - Component = "bbs/article/index", - MenuIcon = "education", - OrderNum = 100, - ParentId = bbs.Id, - IsDeleted = false - }; - entities.Add(article); - - MenuEntity articleQuery = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "文章查询", - PermissionCode = "bbs:article:query", - MenuType = MenuTypeEnum.Component, - OrderNum = 100, - ParentId = article.Id, - IsDeleted = false - }; - entities.Add(articleQuery); - - MenuEntity articleAdd = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "文章新增", - PermissionCode = "bbs:article:add", - MenuType = MenuTypeEnum.Component, - OrderNum = 100, - ParentId = article.Id, - IsDeleted = false - }; - entities.Add(articleAdd); - - MenuEntity articleEdit = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "文章修改", - PermissionCode = "bbs:article:edit", - MenuType = MenuTypeEnum.Component, - OrderNum = 100, - ParentId = article.Id, - IsDeleted = false - }; - entities.Add(articleEdit); - - MenuEntity articleRemove = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "文章删除", - PermissionCode = "bbs:article:remove", - MenuType = MenuTypeEnum.Component, - OrderNum = 100, - ParentId = article.Id, - IsDeleted = false - }; - entities.Add(articleRemove); - - - //主题管理 - MenuEntity discuss = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "主题管理", - PermissionCode = "bbs:discuss:list", - MenuType = MenuTypeEnum.Menu, - Router = "discuss", - IsShow = true, - IsLink = false, - IsCache = true, - Component = "bbs/discuss/index", - MenuIcon = "education", - OrderNum = 100, - ParentId = bbs.Id, - IsDeleted = false - }; - entities.Add(discuss); - - MenuEntity discussQuery = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "主题查询", - PermissionCode = "bbs:discuss:query", - MenuType = MenuTypeEnum.Component, - OrderNum = 100, - ParentId = discuss.Id, - IsDeleted = false - }; - entities.Add(discussQuery); - - MenuEntity discussAdd = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "主题新增", - PermissionCode = "bbs:discuss:add", - MenuType = MenuTypeEnum.Component, - OrderNum = 100, - ParentId = discuss.Id, - IsDeleted = false - }; - entities.Add(discussAdd); - - MenuEntity discussEdit = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "主题修改", - PermissionCode = "bbs:discuss:edit", - MenuType = MenuTypeEnum.Component, - OrderNum = 100, - ParentId = discuss.Id, - IsDeleted = false - }; - entities.Add(discussEdit); - - MenuEntity discussRemove = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "主题删除", - PermissionCode = "bbs:discuss:remove", - MenuType = MenuTypeEnum.Component, - OrderNum = 100, - ParentId = discuss.Id, - IsDeleted = false - }; - entities.Add(discussRemove); - - - - //板块管理 - MenuEntity plate = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "板块管理", - PermissionCode = "bbs:plate:list", - MenuType = MenuTypeEnum.Menu, - Router = "plate", - IsShow = true, - IsLink = false, - IsCache = true, - Component = "bbs/plate/index", - MenuIcon = "education", - OrderNum = 100, - ParentId = bbs.Id, - IsDeleted = false - }; - entities.Add(plate); - - MenuEntity plateQuery = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "板块查询", - PermissionCode = "bbs:plate:query", - MenuType = MenuTypeEnum.Component, - OrderNum = 100, - ParentId = plate.Id, - IsDeleted = false - }; - entities.Add(plateQuery); - - MenuEntity plateAdd = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "板块新增", - PermissionCode = "bbs:plate:add", - MenuType = MenuTypeEnum.Component, - OrderNum = 100, - ParentId = plate.Id, - IsDeleted = false - }; - entities.Add(plateAdd); - - MenuEntity plateEdit = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "板块修改", - PermissionCode = "bbs:plate:edit", - MenuType = MenuTypeEnum.Component, - OrderNum = 100, - ParentId = plate.Id, - IsDeleted = false - }; - entities.Add(plateEdit); - - MenuEntity plateRemove = new MenuEntity() - { - Id = SnowflakeHelper.NextId, - MenuName = "板块删除", - PermissionCode = "bbs:plate:remove", - MenuType = MenuTypeEnum.Component, - OrderNum = 100, - ParentId = plate.Id, - IsDeleted = false - }; - entities.Add(plateRemove); - - //默认值 - entities.ForEach(m => - { - m.IsDeleted = false; - m.State = true; - }); - return entities; - } - } -} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/Exhibition/Entities/AgreeEntity .cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/Exhibition/Entities/AgreeEntity .cs deleted file mode 100644 index 37ab217f..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/Exhibition/Entities/AgreeEntity .cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using SqlSugar; -using Yi.Framework.Data.Auditing; -using Yi.Framework.Data.Entities; -using Yi.Framework.Ddd.Entities; - -namespace Yi.BBS.Domain.Exhibition.Entities -{ - [SugarTable("Agree")] - public class AgreeEntity : IEntity, ICreationAuditedObject - { - public AgreeEntity() - { - } - - public AgreeEntity(long discussId) - { - DiscussId = discussId; - } - - [SugarColumn(IsPrimaryKey = true)] - public long Id { get; set; } = SnowflakeHelper.NextId; - public DateTime CreationTime { get; set; } - - /// - /// 主题id - /// - public long DiscussId { get; set; } - - /// - /// 创建者 - /// - public long? CreatorId { get; set; } - } -} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/Forum/Event/SeeDiscussEventHandler.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/Forum/Event/SeeDiscussEventHandler.cs deleted file mode 100644 index e1e18b47..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/Forum/Event/SeeDiscussEventHandler.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Cike.EventBus.EventHandlerAbstracts; -using Yi.BBS.Domain.Forum.Entities; -using Yi.BBS.Domain.Shared.Forum.Etos; -using Yi.Framework.Ddd.Repositories; -using Yi.RBAC.Domain.Shared.Identity.Etos; - -namespace Yi.BBS.Domain.Forum.Event -{ - public class SeeDiscussEventHandler : IDistributedEventHandler - { - private IRepository _repository; - public SeeDiscussEventHandler(IRepository repository) - { - _repository = repository; - } - public async Task HandlerAsync(SeeDiscussEventArgs eventData) - { - var entity= await _repository.GetByIdAsync(eventData.DiscussId); - if (entity is not null) { - entity.SeeNum += 1; - await _repository.UpdateAsync(entity); - } - - } - } -} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/Yi.BBS.Domain.csproj b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/Yi.BBS.Domain.csproj deleted file mode 100644 index 0bf41efa..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/Yi.BBS.Domain.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - net6.0 - enable - enable - True - ./$(AssemblyName)SwaggerDoc.xml - - - - - - - - - - - - Always - - - - diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/YiBBSDomainModule.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/YiBBSDomainModule.cs deleted file mode 100644 index c9520e98..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain/YiBBSDomainModule.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using StartupModules; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Core.Attributes; -using Yi.Framework.Data; -using Yi.BBS.Domain.Shared; - -namespace Yi.BBS.Domain -{ - [DependsOn( - typeof(YiBBSDomainSharedModule) - )] - public class YiBBSDomainModule : IStartupModule - { - public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) - { - } - - public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) - { - - } - } -} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Sqlsugar/Yi.BBS.Sqlsugar.csproj b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Sqlsugar/Yi.BBS.Sqlsugar.csproj deleted file mode 100644 index 96d709be..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Sqlsugar/Yi.BBS.Sqlsugar.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - net6.0 - enable - enable - - - - - - - - - - - - diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Sqlsugar/YiBBSSqlsugarModule.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Sqlsugar/YiBBSSqlsugarModule.cs deleted file mode 100644 index 82f1798a..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Sqlsugar/YiBBSSqlsugarModule.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using StartupModules; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Core.Attributes; -using Yi.Framework.Core.Sqlsugar; -using Yi.BBS.Domain; -using Yi.RBAC.Sqlsugar; -using SqlSugar; - -namespace Yi.BBS.Sqlsugar -{ - [DependsOn(typeof(YiFrameworkCoreSqlsugarModule), - typeof(YiBBSDomainModule), - typeof(YiRBACSqlsugarModule))] - public class YiBBSSqlsugarModule : IStartupModule - { - public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) - { - - } - - public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) - { - //services.AddTransient(); - } - } -} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/Program.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/Program.cs deleted file mode 100644 index 208cd696..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/Program.cs +++ /dev/null @@ -1,34 +0,0 @@ -using AspNetCore.Microsoft.AspNetCore.Hosting; -using Yi.Framework.Core.Autofac.Extensions; -using Yi.Framework.Core.Autofac.Modules; -using Yi.Framework.Core.Extensions; -using Yi.BBS.Web; -using Yi.Framework.Core.Module; -using NLog.Extensions.Logging; -using NLog; -using SqlSugar; - -var builder = WebApplication.CreateBuilder(args); -builder.Services.AddLogging(builder => { builder.ClearProviders().AddNLog("nlog.config").SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); }); -Logger? _logger = LogManager.Setup().LoadConfigurationFromAssemblyResource(typeof(Program).Assembly).GetCurrentClassLogger(); -_logger.Info("-----( ¯ □ ¯ )YiFrameowrk框架启动-----"); - -builder.WebHost.UseStartUrlsServer(builder.Configuration); - -builder.UseYiModules(typeof(YiBBSWebModule)); - -//添加autofac模块,需要添加模块 -builder.Host.ConfigureAutoFacContainer(container => -{ - container.RegisterYiModule(AutoFacModuleEnum.PropertiesAutowiredModule, ModuleAssembly.Assemblies); -}); - -var app = builder.Build(); -var db = app.Services.GetService(); -app.UseErrorHandlingServer(); - -app.UseAuthentication(); -app.UseAuthorization(); -app.MapControllers(); - -app.Run(); diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/Properties/launchSettings.json b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/Properties/launchSettings.json deleted file mode 100644 index f6eca37f..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/Properties/launchSettings.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "profiles": { - "Yi.BBS.Web": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "http://localhost:19001", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/Yi.BBS.Web.csproj b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/Yi.BBS.Web.csproj deleted file mode 100644 index cbfa880b..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/Yi.BBS.Web.csproj +++ /dev/null @@ -1,52 +0,0 @@ - - - - net6.0 - enable - enable - - - - - - - - - - - - - - Always - - - Always - - - Always - - - Always - - - - - - Always - - - Always - - - Always - - - Always - - - - - - - - diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/YiBBSWebModule.cs b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/YiBBSWebModule.cs deleted file mode 100644 index 490917be..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/YiBBSWebModule.cs +++ /dev/null @@ -1,60 +0,0 @@ -using AspNetCore.Microsoft.AspNetCore.Builder; -using StartupModules; -using Yi.Framework.Auth.JwtBearer; -using Yi.Framework.Core; -using Yi.Framework.Core.Attributes; -using Yi.BBS.Application; -using Yi.BBS.Sqlsugar; -using Yi.Framework.AspNetCore.Microsoft.Extensions.DependencyInjection; -using Yi.Framework.Core.Autofac; -using Yi.RBAC.Application; -using Yi.Framework.AspNetCore; -using Yi.Framework.Data.Json; -using Yi.Framework.OperLogManager; -using Yi.Framework.Core.Module; -using Microsoft.Extensions.Options; -using System.Text.Json.Serialization; - -namespace Yi.BBS.Web -{ - [DependsOn( - typeof(YiBBSSqlsugarModule), - typeof(YiFrameworkAspNetCoreModule), - typeof(YiFrameworkCoreAutofacModule), - typeof(YiBBSApplicationModule) - )] - public class YiBBSWebModule : IStartupModule - { - public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) - { - //添加控制器与动态api - services.AddControllers().AddJsonOptions(opt => { - opt.JsonSerializerOptions.Converters.Add(new DateTimeJsonConverter("yyyy-MM-dd HH:mm:ss")); - opt.JsonSerializerOptions.Converters.Add(new LongToStringConverter()); - opt.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()); - }); - - services.AddAutoApiService(opt => - { - //NETServiceTest所在程序集添加进动态api配置 - opt.CreateConventional(ModuleAssembly.Assemblies, option => option.RootPath = string.Empty); - }); - - //添加swagger - services.AddSwaggerServer(); - } - public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) - { - //if (app.Environment.IsDevelopment()) - { - app.UseSwaggerServer(); - } - - app.UseHttpsRedirection(); - - app.UseAuthorization(); - - app.UseRouting(); - } - } -} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/appsettings.json b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/appsettings.json deleted file mode 100644 index 43792456..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/appsettings.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Debug", - "Microsoft.AspNetCore": "Information" - } - }, - "AllowedHosts": "*", - - //程序启动地址,*代表全部网口 - "StartUrl": "http://*:19001", - - //数据库类型列表 - "DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ], - - "DbConnOptions": { - "Url": "DataSource=yi-sqlsugar-dev.db", - "DbType": "Sqlite", - "EnabledReadWrite": false, - "EnabledCodeFirst": false, - "EntityAssembly": null, - "ReadUrl": [ - "DataSource=[xxxx]", //Sqlite - "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", //Mysql - "Data Source=[xxxx];Initial Catalog=[xxxx];User ID=[xxxx];password=[xxxx]" //Sqlserver - ] - }, - - //授权 - "JwtTokenOptions": { - "Audience": "yi", - "Issuer": "localhost:19002", - "Subject": "yiframwork", - "ExpSecond": 259200 - }, - - //开启种子数据 - "EnabledDataSeed": false, - - //阿里云短信 - "SmsAliyunOptions": { - "AccessKeyId": "", - "AccessKeySecret": "", - "SignName": "", - "TemplateCode": "", - "EnableFeature": false - } -} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/ip2region.db b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/ip2region.db deleted file mode 100644 index 0fc60e6c..00000000 Binary files a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/ip2region.db and /dev/null differ diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/key.pem b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/key.pem deleted file mode 100644 index 3314ab6e..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/key.pem +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC7VJTUt9Us8cKj -MzEfYyjiWA4R4/M2bS1GB4t7NXp98C3SC6dVMvDuictGeurT8jNbvJZHtCSuYEvu -NMoSfm76oqFvAp8Gy0iz5sxjZmSnXyCdPEovGhLa0VzMaQ8s+CLOyS56YyCFGeJZ -qgtzJ6GR3eqoYSW9b9UMvkBpZODSctWSNGj3P7jRFDO5VoTwCQAWbFnOjDfH5Ulg -p2PKSQnSJP3AJLQNFNe7br1XbrhV//eO+t51mIpGSDCUv3E0DDFcWDTH9cXDTTlR -ZVEiR2BwpZOOkE/Z0/BVnhZYL71oZV34bKfWjQIt6V/isSMahdsAASACp4ZTGtwi -VuNd9tybAgMBAAECggEBAKTmjaS6tkK8BlPXClTQ2vpz/N6uxDeS35mXpqasqskV -laAidgg/sWqpjXDbXr93otIMLlWsM+X0CqMDgSXKejLS2jx4GDjI1ZTXg++0AMJ8 -sJ74pWzVDOfmCEQ/7wXs3+cbnXhKriO8Z036q92Qc1+N87SI38nkGa0ABH9CN83H -mQqt4fB7UdHzuIRe/me2PGhIq5ZBzj6h3BpoPGzEP+x3l9YmK8t/1cN0pqI+dQwY -dgfGjackLu/2qH80MCF7IyQaseZUOJyKrCLtSD/Iixv/hzDEUPfOCjFDgTpzf3cw -ta8+oE4wHCo1iI1/4TlPkwmXx4qSXtmw4aQPz7IDQvECgYEA8KNThCO2gsC2I9PQ -DM/8Cw0O983WCDY+oi+7JPiNAJwv5DYBqEZB1QYdj06YD16XlC/HAZMsMku1na2T -N0driwenQQWzoev3g2S7gRDoS/FCJSI3jJ+kjgtaA7Qmzlgk1TxODN+G1H91HW7t -0l7VnL27IWyYo2qRRK3jzxqUiPUCgYEAx0oQs2reBQGMVZnApD1jeq7n4MvNLcPv -t8b/eU9iUv6Y4Mj0Suo/AU8lYZXm8ubbqAlwz2VSVunD2tOplHyMUrtCtObAfVDU -AhCndKaA9gApgfb3xw1IKbuQ1u4IF1FJl3VtumfQn//LiH1B3rXhcdyo3/vIttEk -48RakUKClU8CgYEAzV7W3COOlDDcQd935DdtKBFRAPRPAlspQUnzMi5eSHMD/ISL -DY5IiQHbIH83D4bvXq0X7qQoSBSNP7Dvv3HYuqMhf0DaegrlBuJllFVVq9qPVRnK -xt1Il2HgxOBvbhOT+9in1BzA+YJ99UzC85O0Qz06A+CmtHEy4aZ2kj5hHjECgYEA -mNS4+A8Fkss8Js1RieK2LniBxMgmYml3pfVLKGnzmng7H2+cwPLhPIzIuwytXywh -2bzbsYEfYx3EoEVgMEpPhoarQnYPukrJO4gwE2o5Te6T5mJSZGlQJQj9q4ZB2Dfz -et6INsK0oG8XVGXSpQvQh3RUYekCZQkBBFcpqWpbIEsCgYAnM3DQf3FJoSnXaMhr -VBIovic5l0xFkEHskAjFTevO86Fsz1C2aSeRKSqGFoOQ0tmJzBEs1R6KqnHInicD -TQrKhArgLXX4v3CddjfTRJkFWDbE/CkvKZNOrcf1nhaGCPspRJj2KUkj1Fhl9Cnc -dn/RsYEONbwQSjIfMPkvxF+8HQ== ------END PRIVATE KEY----- \ No newline at end of file diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/public.pem b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/public.pem deleted file mode 100644 index 1c9b622d..00000000 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/public.pem +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu1SU1LfVLPHCozMxH2Mo -4lgOEePzNm0tRgeLezV6ffAt0gunVTLw7onLRnrq0/IzW7yWR7QkrmBL7jTKEn5u -+qKhbwKfBstIs+bMY2Zkp18gnTxKLxoS2tFczGkPLPgizskuemMghRniWaoLcyeh -kd3qqGElvW/VDL5AaWTg0nLVkjRo9z+40RQzuVaE8AkAFmxZzow3x+VJYKdjykkJ -0iT9wCS0DRTXu269V264Vf/3jvredZiKRkgwlL9xNAwxXFg0x/XFw005UWVRIkdg -cKWTjpBP2dPwVZ4WWC+9aGVd+Gyn1o0CLelf4rEjGoXbAAEgAqeGUxrcIlbjXfbc -mwIDAQAB ------END PUBLIC KEY----- \ No newline at end of file diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/yi-sqlsugar-dev.db b/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/yi-sqlsugar-dev.db deleted file mode 100644 index 32705633..00000000 Binary files a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/yi-sqlsugar-dev.db and /dev/null differ diff --git a/Yi.Framework.Net6/src/project/Template/GlobalUsings.cs b/Yi.Framework.Net6/src/project/Template/GlobalUsings.cs deleted file mode 100644 index d6ecb816..00000000 --- a/Yi.Framework.Net6/src/project/Template/GlobalUsings.cs +++ /dev/null @@ -1,4 +0,0 @@ -global using Yi.Framework.Core.Attributes; -global using Yi.Framework.Core.Helper; -global using Yi.Framework.Core.Model; -global using Yi.Framework.Core.Exceptions; \ No newline at end of file diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/ApplicationContractsSwaggerDoc.xml b/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/ApplicationContractsSwaggerDoc.xml deleted file mode 100644 index b9705a65..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/ApplicationContractsSwaggerDoc.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - Yi.Template.Application.Contracts - - - - - Student输入创建对象 - - - - - Student - - - - diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/IStudentService.cs b/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/IStudentService.cs deleted file mode 100644 index a721c5e3..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/IStudentService.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Template.Application.Contracts.School.Dtos; -using Yi.Framework.Ddd.Services.Abstract; - -namespace Yi.Template.Application.Contracts.School -{ - /// - /// Student - /// - public interface IStudentService : ICrudAppService - { - - } -} diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/Yi.Template.Application.Contracts.csproj b/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/Yi.Template.Application.Contracts.csproj deleted file mode 100644 index ea141dde..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/Yi.Template.Application.Contracts.csproj +++ /dev/null @@ -1,23 +0,0 @@ - - - - net6.0 - enable - enable - True - ./ApplicationContractsSwaggerDoc.xml - - - - - - - - - - - Always - - - - diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/YiTemplateApplicationContractsModule.cs b/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/YiTemplateApplicationContractsModule.cs deleted file mode 100644 index d2ea5d76..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/YiTemplateApplicationContractsModule.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using StartupModules; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Core.Attributes; -using Yi.Template.Domain.Shared; - -namespace Yi.Template.Application.Contracts -{ - [DependsOn( - typeof(YiTemplateDomainSharedModule) - )] - public class YiTemplateApplicationContractsModule : IStartupModule - { - public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) - { - } - - public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) - { - } - } -} diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application/ApplicationSwaggerDoc.xml b/Yi.Framework.Net6/src/project/Template/Yi.Template.Application/ApplicationSwaggerDoc.xml deleted file mode 100644 index da7b20a5..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application/ApplicationSwaggerDoc.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - Yi.Template.Application - - - - - Student服务实现 - - - - diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application/School/StudentService.cs b/Yi.Framework.Net6/src/project/Template/Yi.Template.Application/School/StudentService.cs deleted file mode 100644 index cd961206..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application/School/StudentService.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Yi.Template.Application.Contracts.School; -using Cike.AutoWebApi.Setting; -using Yi.Template.Application.Contracts.School.Dtos; -using Yi.Template.Domain.School.Entities; -using Yi.Framework.Ddd.Services; - -namespace Yi.Template.Application.School -{ - /// - /// Student服务实现 - /// - [AppService] - public class StudentService : CrudAppService, - IStudentService, IAutoApiService - { - } -} diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application/Yi.Template.Application.csproj b/Yi.Framework.Net6/src/project/Template/Yi.Template.Application/Yi.Template.Application.csproj deleted file mode 100644 index 0a5bab98..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application/Yi.Template.Application.csproj +++ /dev/null @@ -1,25 +0,0 @@ - - - - net6.0 - enable - enable - True - ./ApplicationSwaggerDoc.xml - - - - - - - - - - - - - Always - - - - diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application/YiTemplateApplicationModule.cs b/Yi.Framework.Net6/src/project/Template/Yi.Template.Application/YiTemplateApplicationModule.cs deleted file mode 100644 index c58eb473..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application/YiTemplateApplicationModule.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using StartupModules; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Template.Application.Contracts; -using Yi.Framework.Auth.JwtBearer; -using Yi.Framework.Core.Attributes; -using Yi.Framework.Data; -using Yi.Framework.Ddd; -using Yi.Template.Domain; - -namespace Yi.Template.Application -{ - [DependsOn( - typeof(YiTemplateApplicationContractsModule), - typeof(YiTemplateDomainModule), - typeof(YiFrameworkAuthJwtBearerModule) - )] - public class YiTemplateApplicationModule : IStartupModule - { - public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) - { - } - - public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) - { - } - } -} diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain.Shared/Yi.Template.Domain.Shared.csproj b/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain.Shared/Yi.Template.Domain.Shared.csproj deleted file mode 100644 index 692994fe..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain.Shared/Yi.Template.Domain.Shared.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - net6.0 - enable - enable - - - - - - - - - diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain.Shared/YiTemplateDomainSharedModule.cs b/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain.Shared/YiTemplateDomainSharedModule.cs deleted file mode 100644 index 4e14cee3..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain.Shared/YiTemplateDomainSharedModule.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using StartupModules; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Core.Attributes; -using Yi.Framework.Ddd; - -namespace Yi.Template.Domain.Shared -{ - [DependsOn( - typeof(YiFrameworkDddModule) - )] - public class YiTemplateDomainSharedModule : IStartupModule - { - public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) - { - } - - public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) - { - } - } -} diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain/DomainSwaggerDoc.xml b/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain/DomainSwaggerDoc.xml deleted file mode 100644 index 01f6d524..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain/DomainSwaggerDoc.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - Yi.Template.Domain - - - - diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain/School/DataSeeds/StudentDataSeed.cs b/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain/School/DataSeeds/StudentDataSeed.cs deleted file mode 100644 index bb3092b9..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain/School/DataSeeds/StudentDataSeed.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Data.DataSeeds; -using Yi.Framework.Ddd.Repositories; -using Yi.Template.Domain.School.Entities; - -namespace Yi.Template.Domain.School.DataSeeds -{ - [AppService(typeof(IDataSeed))] - public class StudentDataSeed : AbstractDataSeed - { - public StudentDataSeed(IRepository repository) : base(repository) - { - } - - public override List GetSeedData() - { - return new List() { new StudentEntity { Id = SnowflakeHelper.NextId, Name = "你好", Phone = "123", Height = 188, IsDeleted = false } , - new StudentEntity { Id = SnowflakeHelper.NextId, Name = "你好1", Phone = "123", Height = 188, IsDeleted = false }, - new StudentEntity { Id = SnowflakeHelper.NextId, Name = "你好2", Phone = "123", Height = 188, IsDeleted = false } - }; - } - } -} diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain/Yi.Template.Domain.csproj b/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain/Yi.Template.Domain.csproj deleted file mode 100644 index 71936c72..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain/Yi.Template.Domain.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - net6.0 - enable - enable - True - ./DomainSwaggerDoc.xml - - - - - - - - - - - - Always - - - - diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain/YiTemplateDomainModule.cs b/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain/YiTemplateDomainModule.cs deleted file mode 100644 index e94138cd..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain/YiTemplateDomainModule.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using StartupModules; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Core.Attributes; -using Yi.Framework.Data; -using Yi.Template.Domain.Shared; - -namespace Yi.Template.Domain -{ - [DependsOn( - typeof(YiTemplateDomainSharedModule), - typeof(YiFrameworkDataModule) - )] - public class YiTemplateDomainModule : IStartupModule - { - public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) - { - } - - public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) - { - //services.AddTransient(); - } - } -} diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Sqlsugar/Yi.Template.Sqlsugar.csproj b/Yi.Framework.Net6/src/project/Template/Yi.Template.Sqlsugar/Yi.Template.Sqlsugar.csproj deleted file mode 100644 index 8f842da8..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Sqlsugar/Yi.Template.Sqlsugar.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - net6.0 - enable - enable - - - - - - - - - - - diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Sqlsugar/YiTemplateSqlsugarModule.cs b/Yi.Framework.Net6/src/project/Template/Yi.Template.Sqlsugar/YiTemplateSqlsugarModule.cs deleted file mode 100644 index 6176073a..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Sqlsugar/YiTemplateSqlsugarModule.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using StartupModules; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Core.Attributes; -using Yi.Framework.Core.Sqlsugar; -using Yi.Template.Domain; - -namespace Yi.Template.Sqlsugar -{ - [DependsOn(typeof(YiFrameworkCoreSqlsugarModule), - typeof(YiTemplateDomainModule))] - public class YiTemplateSqlsugarModule : IStartupModule - { - public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) - { - } - - public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) - { - //services.AddTransient(); - } - } -} diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/Program.cs b/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/Program.cs deleted file mode 100644 index 86c4b3d2..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/Program.cs +++ /dev/null @@ -1,37 +0,0 @@ -using AspNetCore.Microsoft.AspNetCore.Hosting; -using NLog; -using NLog.Extensions.Logging; -using Yi.Framework.Core.Autofac.Extensions; -using Yi.Framework.Core.Autofac.Modules; -using Yi.Framework.Core.Extensions; -using Yi.Framework.Core.Module; -using Yi.Template.Web; - - -var builder = WebApplication.CreateBuilder(args); -//配置日志 -builder.Services.AddLogging(builder => { builder.ClearProviders().AddNLog("nlog.config").SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Trace); }); -Logger? _logger = LogManager.Setup().LoadConfigurationFromAssemblyResource(typeof(Program).Assembly).GetCurrentClassLogger(); -_logger.Info("-----( ¯ □ ¯ )YiFrameowrk框架启动-----"); -//设置启动url -builder.WebHost.UseStartUrlsServer(builder.Configuration); - -//添加模块 -builder.UseYiModules(typeof(YiTemplateWebModule)); - -//添加autofac模块,需要添加模块 -builder.Host.ConfigureAutoFacContainer(container => -{ - container.RegisterYiModule(AutoFacModuleEnum.PropertiesAutowiredModule, ModuleAssembly.Assemblies); -}); - -var app = builder.Build(); - -//全局错误中间件,需要放在最早 -app.UseErrorHandlingServer(); - -app.UseAuthentication(); -app.UseAuthorization(); -app.MapControllers(); - -app.Run(); diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/Properties/launchSettings.json b/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/Properties/launchSettings.json deleted file mode 100644 index 1384d89f..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/Properties/launchSettings.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "profiles": { - "Yi.Template.Web": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "launchUrl": "swagger", - "applicationUrl": "http://localhost:19002", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/Yi.Template.Web.csproj b/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/Yi.Template.Web.csproj deleted file mode 100644 index 97d143a9..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/Yi.Template.Web.csproj +++ /dev/null @@ -1,33 +0,0 @@ - - - - net6.0 - enable - enable - - - - - - - - - - - - - - Always - - - - - - Always - - - Always - - - - diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/YiTemplateWebModule.cs b/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/YiTemplateWebModule.cs deleted file mode 100644 index 194428a6..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/YiTemplateWebModule.cs +++ /dev/null @@ -1,52 +0,0 @@ -using AspNetCore.Microsoft.AspNetCore.Builder; -using StartupModules; -using Yi.Framework.AspNetCore; -using Yi.Framework.Auth.JwtBearer; -using Yi.Framework.Core; -using Yi.Framework.Core.Attributes; -using Yi.Framework.Core.Autofac; -using Yi.Framework.Core.Module; -using Yi.Framework.Data.Json; -using Yi.Template.Application; -using Yi.Template.Sqlsugar; - -namespace Yi.Template.Web -{ - [DependsOn( - typeof(YiFrameworkAspNetCoreModule), - typeof(YiFrameworkCoreAutofacModule), - typeof(YiTemplateSqlsugarModule), - typeof(YiTemplateApplicationModule) - )] - public class YiTemplateWebModule : IStartupModule - { - public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context) - { - //添加控制器与动态api - services.AddControllers().AddJsonOptions(opt => { - opt.JsonSerializerOptions.Converters.Add(new DateTimeJsonConverter("yyyy-MM-dd HH:mm:ss")); - }); - services.AddAutoApiService(opt => - { - //NETServiceTest所在程序集添加进动态api配置 - opt.CreateConventional(ModuleAssembly.Assemblies, option => option.RootPath = string.Empty); - }); - - //添加swagger - services.AddSwaggerServer(); - } - public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context) - { - //if (app.Environment.IsDevelopment()) - { - app.UseSwaggerServer(); - } - - app.UseHttpsRedirection(); - - app.UseAuthorization(); - - app.UseRouting(); - } - } -} diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/appsettings.json b/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/appsettings.json deleted file mode 100644 index ddf70ea3..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/appsettings.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - //"Default": "Debug", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*", - - //程序启动地址,*代表全部网口 - "StartUrl": "http://*:19002", - - //数据库类型列表 - "DbList": [ "Sqlite", "Mysql", "Sqlserver", "Oracle" ], - - "DbConnOptions": { - "Url": "DataSource=yi-sqlsugar-dev.db", - "DbType": "Sqlite", - "EnabledDbSeed": false, - "EnabledReadWrite": false, - "EnabledCodeFirst": true, - "EntityAssembly": null, - "ReadUrl": [ - "DataSource=[xxxx]", //sqlite - "server=[xxxx];port=3306;database=[xxxx];user id=[xxxx];password=[xxxx]", //mysql - "Data Source=[xxxx];Initial Catalog=[xxxx];User ID=[xxxx];password=[xxxx]" //sqlserver - ] - }, - - //授权 - "JwtTokenOptions": { - "Audience": "yi", - "Issuer": "localhost:19002", - "Subject": "yiframwork", - "ExpSecond": 3600 - }, - - //开启种子数据 - "EnabledDataSeed": true -} diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/key.pem b/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/key.pem deleted file mode 100644 index 3314ab6e..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/key.pem +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC7VJTUt9Us8cKj -MzEfYyjiWA4R4/M2bS1GB4t7NXp98C3SC6dVMvDuictGeurT8jNbvJZHtCSuYEvu -NMoSfm76oqFvAp8Gy0iz5sxjZmSnXyCdPEovGhLa0VzMaQ8s+CLOyS56YyCFGeJZ -qgtzJ6GR3eqoYSW9b9UMvkBpZODSctWSNGj3P7jRFDO5VoTwCQAWbFnOjDfH5Ulg -p2PKSQnSJP3AJLQNFNe7br1XbrhV//eO+t51mIpGSDCUv3E0DDFcWDTH9cXDTTlR -ZVEiR2BwpZOOkE/Z0/BVnhZYL71oZV34bKfWjQIt6V/isSMahdsAASACp4ZTGtwi -VuNd9tybAgMBAAECggEBAKTmjaS6tkK8BlPXClTQ2vpz/N6uxDeS35mXpqasqskV -laAidgg/sWqpjXDbXr93otIMLlWsM+X0CqMDgSXKejLS2jx4GDjI1ZTXg++0AMJ8 -sJ74pWzVDOfmCEQ/7wXs3+cbnXhKriO8Z036q92Qc1+N87SI38nkGa0ABH9CN83H -mQqt4fB7UdHzuIRe/me2PGhIq5ZBzj6h3BpoPGzEP+x3l9YmK8t/1cN0pqI+dQwY -dgfGjackLu/2qH80MCF7IyQaseZUOJyKrCLtSD/Iixv/hzDEUPfOCjFDgTpzf3cw -ta8+oE4wHCo1iI1/4TlPkwmXx4qSXtmw4aQPz7IDQvECgYEA8KNThCO2gsC2I9PQ -DM/8Cw0O983WCDY+oi+7JPiNAJwv5DYBqEZB1QYdj06YD16XlC/HAZMsMku1na2T -N0driwenQQWzoev3g2S7gRDoS/FCJSI3jJ+kjgtaA7Qmzlgk1TxODN+G1H91HW7t -0l7VnL27IWyYo2qRRK3jzxqUiPUCgYEAx0oQs2reBQGMVZnApD1jeq7n4MvNLcPv -t8b/eU9iUv6Y4Mj0Suo/AU8lYZXm8ubbqAlwz2VSVunD2tOplHyMUrtCtObAfVDU -AhCndKaA9gApgfb3xw1IKbuQ1u4IF1FJl3VtumfQn//LiH1B3rXhcdyo3/vIttEk -48RakUKClU8CgYEAzV7W3COOlDDcQd935DdtKBFRAPRPAlspQUnzMi5eSHMD/ISL -DY5IiQHbIH83D4bvXq0X7qQoSBSNP7Dvv3HYuqMhf0DaegrlBuJllFVVq9qPVRnK -xt1Il2HgxOBvbhOT+9in1BzA+YJ99UzC85O0Qz06A+CmtHEy4aZ2kj5hHjECgYEA -mNS4+A8Fkss8Js1RieK2LniBxMgmYml3pfVLKGnzmng7H2+cwPLhPIzIuwytXywh -2bzbsYEfYx3EoEVgMEpPhoarQnYPukrJO4gwE2o5Te6T5mJSZGlQJQj9q4ZB2Dfz -et6INsK0oG8XVGXSpQvQh3RUYekCZQkBBFcpqWpbIEsCgYAnM3DQf3FJoSnXaMhr -VBIovic5l0xFkEHskAjFTevO86Fsz1C2aSeRKSqGFoOQ0tmJzBEs1R6KqnHInicD -TQrKhArgLXX4v3CddjfTRJkFWDbE/CkvKZNOrcf1nhaGCPspRJj2KUkj1Fhl9Cnc -dn/RsYEONbwQSjIfMPkvxF+8HQ== ------END PRIVATE KEY----- \ No newline at end of file diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/public.pem b/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/public.pem deleted file mode 100644 index 1c9b622d..00000000 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/public.pem +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN PUBLIC KEY----- -MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAu1SU1LfVLPHCozMxH2Mo -4lgOEePzNm0tRgeLezV6ffAt0gunVTLw7onLRnrq0/IzW7yWR7QkrmBL7jTKEn5u -+qKhbwKfBstIs+bMY2Zkp18gnTxKLxoS2tFczGkPLPgizskuemMghRniWaoLcyeh -kd3qqGElvW/VDL5AaWTg0nLVkjRo9z+40RQzuVaE8AkAFmxZzow3x+VJYKdjykkJ -0iT9wCS0DRTXu269V264Vf/3jvredZiKRkgwlL9xNAwxXFg0x/XFw005UWVRIkdg -cKWTjpBP2dPwVZ4WWC+9aGVd+Gyn1o0CLelf4rEjGoXbAAEgAqeGUxrcIlbjXfbc -mwIDAQAB ------END PUBLIC KEY----- \ No newline at end of file diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/yi-sqlsugar-dev.db b/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/yi-sqlsugar-dev.db deleted file mode 100644 index a53c9587..00000000 Binary files a/Yi.Framework.Net6/src/project/Template/Yi.Template.Web/yi-sqlsugar-dev.db and /dev/null differ diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Banner/BannerCreateInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Banner/BannerCreateInputVo.cs new file mode 100644 index 00000000..74bde802 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Banner/BannerCreateInputVo.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Application.Contracts.Exhibition.Dtos.Banner +{ + /// + /// Banner输入创建对象 + /// + public class BannerCreateInputVo + { + public string Name { get; set; } + public string? Logo { get; set; } + public string? Color { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Banner/BannerGetListInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Banner/BannerGetListInputVo.cs new file mode 100644 index 00000000..e2fa88af --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Banner/BannerGetListInputVo.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Ddd.Dtos; + +namespace Yi.BBS.Application.Contracts.Exhibition.Dtos.Banner +{ + public class BannerGetListInputVo : PagedAndSortedResultRequestDto + { + public string Name { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Banner/BannerGetListOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Banner/BannerGetListOutputDto.cs new file mode 100644 index 00000000..e45f7700 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Banner/BannerGetListOutputDto.cs @@ -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.Ddd.Dtos; + +namespace Yi.BBS.Application.Contracts.Exhibition.Dtos.Banner +{ + public class BannerGetListOutputDto : IEntityDto + { + + 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; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Banner/BannerGetOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Banner/BannerGetOutputDto.cs new file mode 100644 index 00000000..18bb227b --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Banner/BannerGetOutputDto.cs @@ -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.Ddd.Dtos; + +namespace Yi.BBS.Application.Contracts.Exhibition.Dtos +{ + public class BannerGetOutputDto : IEntityDto + { + + 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; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Banner/BannerUpdateInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Banner/BannerUpdateInputVo.cs new file mode 100644 index 00000000..a4fef3ae --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/Dtos/Banner/BannerUpdateInputVo.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Application.Contracts.Exhibition.Dtos.Banner +{ + public class BannerUpdateInputVo + { + public string? Name { get; set; } + public string? Logo { get; set; } + public string? Color { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/IBannerService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/IBannerService.cs new file mode 100644 index 00000000..a488e4fd --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Exhibition/IBannerService.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.BBS.Application.Contracts.Exhibition.Dtos; +using Yi.BBS.Application.Contracts.Exhibition.Dtos.Banner; +using Yi.Framework.Ddd.Services.Abstract; + +namespace Yi.BBS.Application.Contracts.Exhibition +{ + /// + /// Banner抽象 + /// + public interface IBannerService : ICrudAppService + { + + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleAllOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleAllOutputDto.cs new file mode 100644 index 00000000..eff34670 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleAllOutputDto.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Ddd.Dtos; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + public class ArticleAllOutputDto : IEntityDto + { + 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 Children { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleCreateInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleCreateInputVo.cs new file mode 100644 index 00000000..2372df66 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleCreateInputVo.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + /// + /// Article输入创建对象 + /// + public class ArticleCreateInputVo + { + public string Content { get; set; } + public string Name { get; set; } + public long DiscussId { get; set; } + public long ParentId { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleGetListInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleGetListInputVo.cs new file mode 100644 index 00000000..85ea760a --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleGetListInputVo.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Ddd.Dtos; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + 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; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleGetListOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleGetListOutputDto.cs new file mode 100644 index 00000000..569097ed --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleGetListOutputDto.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Ddd.Dtos; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + public class ArticleGetListOutputDto : IEntityDto + { + public long Id { get; set; } + //ѯݣܿ + //public string Content { get; set; } + public string Name { get; set; } + public long DiscussId { get; set; } + + public List Children { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleGetOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleGetOutputDto.cs new file mode 100644 index 00000000..8d3acff7 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleGetOutputDto.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Ddd.Dtos; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + public class ArticleGetOutputDto : IEntityDto + { + 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; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleUpdateInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleUpdateInputVo.cs new file mode 100644 index 00000000..a9877566 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Article/ArticleUpdateInputVo.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + public class ArticleUpdateInputVo + { + public string Content { get; set; } + public string Name { get; set; } + public long DiscussId { get; set; } + public long ParentId { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentCreateInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentCreateInputVo.cs new file mode 100644 index 00000000..02002a15 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentCreateInputVo.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SqlSugar; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + /// + /// Comment输入创建对象 + /// + public class CommentCreateInputVo + { + + /// + /// 评论id + /// + public string Content { get; set; } + + /// + /// 主题id + /// + public long DiscussId { get; set; } + + /// + /// 第一层评论id,第一层为0 + /// + public long RootId { get; set; } + + /// + /// 被回复的CommentId,第一层为0 + /// + public long ParentId { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetListInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetListInputVo.cs new file mode 100644 index 00000000..64a4c0ea --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetListInputVo.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SqlSugar; +using Yi.Framework.Ddd.Dtos; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + public class CommentGetListInputVo + { + public DateTime? creationTime { get; set; } + public string? Content { get; set; } + + //ӦѡĪѯ + public long? DiscussId { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetListOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetListOutputDto.cs new file mode 100644 index 00000000..156180bd --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetListOutputDto.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SqlSugar; +using Yi.Framework.Ddd.Dtos; +using Yi.RBAC.Application.Contracts.Identity.Dtos; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + /// + /// ۶෴ + /// + public class CommentGetListOutputDto : IEntityDto + { + public long Id { get; set; } + + + public DateTime? CreationTime { get; set; } + + + + + public string Content { get; set; } + + + /// + /// id + /// + public long DiscussId { get; set; } + + public long ParentId { get; set; } + + public long RootId { get; set; } + + /// + /// û,ûϢ + /// + public UserGetOutputDto CreateUser { get; set; } + + /// + /// ۵ûϢ + /// + public UserGetOutputDto CommentedUser { get; set; } + + + /// + /// һΣǴһά飬Childrenֻڶʱֻһ + /// + public List Children { get; set; } = new List(); + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetOutputDto.cs new file mode 100644 index 00000000..962aa71d --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentGetOutputDto.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SqlSugar; +using Yi.Framework.Ddd.Dtos; +using Yi.RBAC.Application.Contracts.Identity.Dtos; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + /// + /// أصۼ + /// + public class CommentGetOutputDto : IEntityDto + { + public long Id { get; set; } + + public DateTime? CreateTime { get; set; } + public string Content { get; set; } + + public long DiscussId { get; set; } + + + /// + /// ûidΪû + /// + + public UserGetOutputDto User { get; set; } + /// + /// ڵid + /// + public long RootId { get; set; } + + /// + /// ظCommentId + /// + public long ParentId { get; set; } + + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentUpdateInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentUpdateInputVo.cs new file mode 100644 index 00000000..24186997 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Comment/CommentUpdateInputVo.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using SqlSugar; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + public class CommentUpdateInputVo + { + + public string Content { get; set; } + + //²ܽת + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussCreateInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussCreateInputVo.cs new file mode 100644 index 00000000..4e3093e5 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussCreateInputVo.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.BBS.Domain.Shared.Forum.EnumClasses; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss +{ + /// + /// Discuss输入创建对象 + /// + 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; } + + /// + /// 默认公开 + /// + public DiscussPermissionTypeEnum PermissionType { get; set; } = DiscussPermissionTypeEnum.Public; + /// + /// 封面 + /// + public string? Cover { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussGetListInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussGetListInputVo.cs new file mode 100644 index 00000000..b336ed17 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussGetListInputVo.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.BBS.Domain.Shared.Forum.ConstClasses; +using Yi.BBS.Domain.Shared.Forum.EnumClasses; +using Yi.Framework.Ddd.Dtos; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss +{ + public class DiscussGetListInputVo : PagedAndSortedResultRequestDto + { + public string? Title { get; set; } + + public long? PlateId { get; set; } + + //Ĭϲѯö + public bool IsTop { get; set; } = false; + + + //ѯʽ + public QueryDiscussTypeEnum Type { get; set; } = QueryDiscussTypeEnum.New; + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussGetListOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussGetListOutputDto.cs new file mode 100644 index 00000000..7042feb7 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussGetListOutputDto.cs @@ -0,0 +1,99 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.BBS.Domain.Shared.Forum.ConstClasses; +using Yi.BBS.Domain.Shared.Forum.EnumClasses; +using Yi.Framework.Ddd.Dtos; +using Yi.RBAC.Application.Contracts.Identity.Dtos; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss +{ + public class DiscussGetListOutputDto : IEntityDto + { + /// + /// Ƿѵ + /// + public bool IsAgree { get; set; } + public long Id { get; set; } + public string Title { get; set; } + public string Types { get; set; } + public string? Introduction { get; set; } + + public int AgreeNum { get; set; } + public int SeeNum { get; set; } + + //ѯݣܿ + //public string Content { get; set; } + public string? Color { get; set; } + + public long PlateId { get; set; } + + //ǷöĬfalse + public bool IsTop { get; set; } + + public DiscussPermissionTypeEnum PermissionType { get; set; } + //ǷֹĬfalse + public bool IsBan { get; set; } + + + /// + /// + /// + public string? Cover { get; set; } + + //˽ҪжcodeȨ + public string? PrivateCode { get; set; } + public DateTime CreationTime { get; set; } + + public List PermissionUserIds { get; set; } + + public UserGetListOutputDto User { get; set; } + + public void SetBan() + { + this.Title = DiscussConst.˽; + this.Introduction = ""; + this.Cover = null; + //ֹ + this.IsBan = true; + } + } + + + public static class DiscussGetListOutputDtoExtension + { + + public static void ApplyPermissionTypeFilter(this List dtos, long userId) + { + dtos?.ForEach(dto => + { + switch (dto.PermissionType) + { + case DiscussPermissionTypeEnum.Public: + break; + case DiscussPermissionTypeEnum.Oneself: + //ǰǽԼɼͬʱǵǰ¼û + if (dto.User.Id != userId) + { + dto.SetBan(); + } + break; + case DiscussPermissionTypeEnum.User: + //ǰΪֿɼͬʱǵǰ¼û Ҳ ڿɼûб + if (dto.User.Id != userId && !dto.PermissionUserIds.Contains(userId)) + { + dto.SetBan(); + } + break; + default: + break; + } + }); + } + + } + +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussGetOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussGetOutputDto.cs new file mode 100644 index 00000000..57eb36b2 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussGetOutputDto.cs @@ -0,0 +1,44 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.BBS.Domain.Shared.Forum.EnumClasses; +using Yi.Framework.Ddd.Dtos; +using Yi.RBAC.Application.Contracts.Identity.Dtos; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + public class DiscussGetOutputDto : IEntityDto + { + + public long Id { get; set; } + public string Title { get; set; } + public string? Types { get; set; } + public string? Introduction { get; set; } + public int AgreeNum { get; set; } + public int SeeNum { get; set; } + public string Content { get; set; } + public string? Color { get; set; } + + public long PlateId { get; set; } + //ǷöĬfalse + public bool IsTop { get; set; } + + /// + /// + /// + public string? Cover { get; set; } + //Ƿ˽УĬfalse + public bool IsPrivate { get; set; } + + //˽ҪжcodeȨ + public string? PrivateCode { get; set; } + public DateTime CreationTime { get; set; } + public DiscussPermissionTypeEnum PermissionType { get; set; } + + public List PermissionUserIds { get; set; } + public UserGetListOutputDto User { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussUpdateInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussUpdateInputVo.cs new file mode 100644 index 00000000..b6e53d15 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Discuss/DiscussUpdateInputVo.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.BBS.Domain.Shared.Forum.EnumClasses; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss +{ + 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 PermissionUserIds { get; set; } + + public DiscussPermissionTypeEnum PermissionType { get; set; } + + /// + /// + /// + public string? Cover { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/MyType/MyTypeCreateInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/MyType/MyTypeCreateInputVo.cs new file mode 100644 index 00000000..8b23c3b0 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/MyType/MyTypeCreateInputVo.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + /// + /// Label输入创建对象 + /// + public class MyTypeCreateInputVo + { + public string Name { get; set; } + public string? Color { get; set; } + public string? BackgroundColor { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/MyType/MyTypeGetListInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/MyType/MyTypeGetListInputVo.cs new file mode 100644 index 00000000..c81f294a --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/MyType/MyTypeGetListInputVo.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Ddd.Dtos; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + 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; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/MyType/MyTypeGetListOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/MyType/MyTypeGetListOutputDto.cs new file mode 100644 index 00000000..93180425 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/MyType/MyTypeGetListOutputDto.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Ddd.Dtos; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + public class MyTypeGetListOutputDto : IEntityDto + { + 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; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/MyType/MyTypeOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/MyType/MyTypeOutputDto.cs new file mode 100644 index 00000000..b25fd998 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/MyType/MyTypeOutputDto.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Ddd.Dtos; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + public class MyTypeOutputDto : IEntityDto + { + 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; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/MyType/MyTypeUpdateInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/MyType/MyTypeUpdateInputVo.cs new file mode 100644 index 00000000..1adc2969 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/MyType/MyTypeUpdateInputVo.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + 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; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Plate/PlateCreateInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Plate/PlateCreateInputVo.cs new file mode 100644 index 00000000..faa6dace --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Plate/PlateCreateInputVo.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos.Plate +{ + /// + /// Plate输入创建对象 + /// + public class PlateCreateInputVo + { + public long Id { get; set; } + public string Name { get; set; } + public string? Logo { get; set; } + public string? Introduction { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Plate/PlateGetListInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Plate/PlateGetListInputVo.cs new file mode 100644 index 00000000..b814da0d --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Plate/PlateGetListInputVo.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Ddd.Dtos; + +namespace Yi.BBS.Application.Contracts.Forum.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; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Plate/PlateGetListOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Plate/PlateGetListOutputDto.cs new file mode 100644 index 00000000..14841038 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Plate/PlateGetListOutputDto.cs @@ -0,0 +1,19 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Ddd.Dtos; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos.Plate +{ + public class PlateGetListOutputDto : IEntityDto + { + + public long Id { get; set; } + public string Name { get; set; } + public string? Logo { get; set; } + public string? Introduction { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Plate/PlateGetOutputDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Plate/PlateGetOutputDto.cs new file mode 100644 index 00000000..8bc031f1 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Plate/PlateGetOutputDto.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Ddd.Dtos; + +namespace Yi.BBS.Application.Contracts.Forum.Dtos +{ + public class PlateGetOutputDto : IEntityDto + { + public long Id { get; set; } + public string Name { get; set; } + public string? Logo { get; set; } + public string? Introduction { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Plate/PlateUpdateInputVo.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Plate/PlateUpdateInputVo.cs new file mode 100644 index 00000000..c033bd3d --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/Dtos/Plate/PlateUpdateInputVo.cs @@ -0,0 +1,18 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Application.Contracts.Forum.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; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/IArticleService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/IArticleService.cs new file mode 100644 index 00000000..c1c8a411 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/IArticleService.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.BBS.Application.Contracts.Forum.Dtos; +using Yi.Framework.Ddd.Services.Abstract; + +namespace Yi.BBS.Application.Contracts.Forum +{ + /// + /// Article服务抽象 + /// + public interface IArticleService : ICrudAppService + { + + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/ICommentService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/ICommentService.cs new file mode 100644 index 00000000..eccbc829 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/ICommentService.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.BBS.Application.Contracts.Forum.Dtos; +using Yi.Framework.Ddd.Services.Abstract; + +namespace Yi.BBS.Application.Contracts.Forum +{ + /// + /// Comment服务抽象 + /// + public interface ICommentService : ICrudAppService + { + + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/IDiscussService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/IDiscussService.cs new file mode 100644 index 00000000..21710f40 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/IDiscussService.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.BBS.Application.Contracts.Forum.Dtos; +using Yi.BBS.Application.Contracts.Forum.Dtos.Discuss; +using Yi.Framework.Ddd.Services.Abstract; + +namespace Yi.BBS.Application.Contracts.Forum +{ + /// + /// Discuss服务抽象 + /// + public interface IDiscussService : ICrudAppService + { + Task VerifyDiscussPermissionAsync(long discussId); + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/ILabelService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/ILabelService.cs new file mode 100644 index 00000000..bcbacbec --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/ILabelService.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.BBS.Application.Contracts.Forum.Dtos; +using Yi.Framework.Ddd.Services.Abstract; + +namespace Yi.BBS.Application.Contracts.Forum +{ + /// + /// Label服务抽象 + /// + public interface ILabelService : ICrudAppService + { + + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/IPlateService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/IPlateService.cs new file mode 100644 index 00000000..3fe9452c --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Forum/IPlateService.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.BBS.Application.Contracts.Forum.Dtos; +using Yi.BBS.Application.Contracts.Forum.Dtos.Plate; +using Yi.Framework.Ddd.Services.Abstract; + +namespace Yi.BBS.Application.Contracts.Forum +{ + /// + /// Plate服务抽象 + /// + public interface IPlateService : ICrudAppService + { + + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/GlobalSetting/Dtos/Temp/ActionJwtDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/GlobalSetting/Dtos/Temp/ActionJwtDto.cs new file mode 100644 index 00000000..1abc63bb --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/GlobalSetting/Dtos/Temp/ActionJwtDto.cs @@ -0,0 +1,18 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Application.Contracts.GlobalSetting.Dtos.Temp +{ + public class ActionJwtDto + { + + public long Id { get; set; } + public string ActionName { get; set; } + public string Router { get; set; } + public string Icon { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/GlobalSetting/Dtos/Temp/LoginDto.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/GlobalSetting/Dtos/Temp/LoginDto.cs new file mode 100644 index 00000000..416fdb9e --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/GlobalSetting/Dtos/Temp/LoginDto.cs @@ -0,0 +1,31 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Application.Contracts.GlobalSetting.Dtos.Temp +{ + public class LoginDto + { + public LoginDto(string token) + { + Token = token; + } + public string Token { get; set; } + public LoginUserInfoDto User{get;set;} + } + + public class LoginUserInfoDto + { + + public long Id { get; set; } + + public string UserName { get; set; } + + public int Level { get; set; } + + public string Icon { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/GlobalSetting/ISettingService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/GlobalSetting/ISettingService.cs new file mode 100644 index 00000000..8820dc26 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/GlobalSetting/ISettingService.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Ddd.Services.Abstract; + +namespace Yi.BBS.Application.Contracts.GlobalSetting +{ + /// + /// Setting应用抽象 + /// + public interface ISettingService : IApplicationService + { + /// + /// 获取配置标题 + /// + /// + Task GetTitleAsync(); + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Yi.BBS.Application.ContractsSwaggerDoc.xml b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Yi.BBS.Application.ContractsSwaggerDoc.xml new file mode 100644 index 00000000..dfaac78a --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application.Contracts/Yi.BBS.Application.ContractsSwaggerDoc.xml @@ -0,0 +1,174 @@ + + + + Yi.BBS.Application.Contracts + + + + + Banner输入创建对象 + + + + + Banner抽象 + + + + + Article输入创建对象 + + + + + Comment输入创建对象 + + + + + 评论id + + + + + 主题id + + + + + 第一层评论id,第一层为0 + + + + + 被回复的CommentId,第一层为0 + + + + + 评论多反 + + + + + 主题id + + + + + 用户,评论人用户信息 + + + + + 被评论的用户信息 + + + + + 这个不是一个树形,而是存在一个二维数组,该Children只有在顶级时候,只有一层 + + + + + 单返回,返回单条评论即可 + + + + + 用户id联表为用户对象 + + + + + 根节点的评论id + + + + + 被回复的CommentId + + + + + Discuss输入创建对象 + + + + + 默认公开 + + + + + 封面 + + + + + 是否已点赞 + + + + + 封面 + + + + + 封面 + + + + + 封面 + + + + + Label输入创建对象 + + + + + Plate输入创建对象 + + + + + Article服务抽象 + + + + + Comment服务抽象 + + + + + Discuss服务抽象 + + + + + Label服务抽象 + + + + + Plate服务抽象 + + + + + Setting应用抽象 + + + + + 获取配置标题 + + + + + diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Exhibition/BannerService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Exhibition/BannerService.cs new file mode 100644 index 00000000..94b25c30 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Exhibition/BannerService.cs @@ -0,0 +1,18 @@ +using Yi.BBS.Application.Contracts.Exhibition; +using Cike.AutoWebApi.Setting; +using Yi.BBS.Application.Contracts.Exhibition.Dtos; +using Yi.BBS.Domain.Exhibition.Entities; +using Yi.Framework.Ddd.Services; +using Yi.BBS.Application.Contracts.Exhibition.Dtos.Banner; + +namespace Yi.BBS.Application.Exhibition +{ + /// + /// Banner服务实现 + /// + [AppService] + public class BannerService : CrudAppService, + IBannerService, IAutoApiService + { + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/ArticleService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/ArticleService.cs new file mode 100644 index 00000000..b69cd865 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/ArticleService.cs @@ -0,0 +1,113 @@ +using Yi.BBS.Application.Contracts.Forum; +using Cike.AutoWebApi.Setting; +using Yi.BBS.Application.Contracts.Forum.Dtos; +using Yi.BBS.Domain.Forum.Entities; +using Yi.Framework.Ddd.Services; +using Yi.Framework.Ddd.Dtos; +using Microsoft.AspNetCore.Mvc; +using Yi.BBS.Domain.Forum.Repositories; +using Yi.Framework.Ddd.Repositories; +using Yi.BBS.Domain.Shared.Forum.ConstClasses; +using Yi.BBS.Domain.Shared.Forum.EnumClasses; +using Yi.Framework.Core.CurrentUsers; +using Yi.RBAC.Domain.Shared.Identity.ConstClasses; + +namespace Yi.BBS.Application.Forum +{ + /// + /// Article服务实现 + /// + [AppService] + + public class ArticleService : CrudAppService, + IArticleService, IAutoApiService + { + [Autowired] + private IArticleRepository _articleRepository { get; set; } + + + [Autowired] + private IRepository _discussRepository { get; set; } + + [Autowired] + private ICurrentUser _currentUser { get; set; } + + [Autowired] + private IDiscussService _discussService { get; set; } + /// + /// 获取文章全部平铺信息 + /// + /// + /// + /// + [Route("/api/article/all/discuss-id/{discussId}")] + public async Task> 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>(entities); + return items; + } + + /// + /// 查询文章 + /// + /// + /// + /// + public async Task> 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; + } + + /// + /// 发表文章 + /// + /// + /// + /// + public async override Task 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); + } + + + /// + /// 效验创建权限 + /// + /// + /// + 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("无权限在其他用户主题中创建子文章"); + } + } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/CommentService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/CommentService.cs new file mode 100644 index 00000000..6dd7b8cc --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/CommentService.cs @@ -0,0 +1,109 @@ +using Yi.BBS.Application.Contracts.Forum; +using Cike.AutoWebApi.Setting; +using Yi.BBS.Application.Contracts.Forum.Dtos; +using Yi.BBS.Domain.Forum.Entities; +using Yi.Framework.Ddd.Services; +using Microsoft.AspNetCore.Mvc; +using Yi.BBS.Domain.Forum; +using Yi.Framework.Core.CurrentUsers; +using Yi.Framework.Ddd.Repositories; +using Yi.BBS.Domain.Shared.Forum.ConstClasses; +using Yi.BBS.Application.Contracts.Forum.Dtos.Discuss; +using Yi.Framework.Ddd.Dtos; +using SqlSugar; +using System.Security.AccessControl; +using System.Linq; +using System.Xml.Linq; +using System.Collections.Generic; + +namespace Yi.BBS.Application.Forum +{ + /// + /// 评论 + /// + [AppService] + public class CommentService : CrudAppService, + ICommentService, IAutoApiService + { + [Autowired] + private ForumManager _forumManager { get; set; } + + [Autowired] + private ICurrentUser _currentUser { get; set; } + + [Autowired] + private IRepository _discussRepository { get; set; } + + [Autowired] + private IDiscussService _discussService { get; set; } + /// + /// 获取改主题下的评论,结构为二维列表,该查询无分页 + /// + /// + /// + /// + public async Task> 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? items = await MapToGetListOutputDtosAsync(outPut); + return new PagedResultDto(entities.Count(), items); + } + + + /// + /// 发表评论 + /// + /// + /// + /// + public override async Task 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); + } + + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/DiscussService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/DiscussService.cs new file mode 100644 index 00000000..2009a82c --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/DiscussService.cs @@ -0,0 +1,154 @@ +using Yi.BBS.Application.Contracts.Forum; +using Cike.AutoWebApi.Setting; +using Yi.BBS.Application.Contracts.Forum.Dtos; +using Yi.BBS.Domain.Forum.Entities; +using Yi.Framework.Ddd.Services; +using Yi.BBS.Application.Contracts.Forum.Dtos.Discuss; +using Microsoft.AspNetCore.Mvc; +using Yi.Framework.Ddd.Dtos; +using Yi.BBS.Domain.Forum; +using MapsterMapper; +using SqlSugar; +using Microsoft.AspNetCore.Routing; +using Yi.BBS.Domain.Shared.Forum.ConstClasses; +using Yi.Framework.Ddd.Repositories; +using Yi.RBAC.Domain.Identity.Entities; +using Yi.RBAC.Application.Contracts.Identity.Dtos; +using Cike.EventBus.DistributedEvent; +using Yi.BBS.Domain.Shared.Forum.Etos; +using Yi.BBS.Domain.Shared.Forum.EnumClasses; +using Yi.Framework.Core.CurrentUsers; +using Yi.BBS.Domain.Exhibition.Entities; + +namespace Yi.BBS.Application.Forum +{ + /// + /// Discuss应用服务实现,用于参数效验、领域服务业务组合、日志记录、事务处理、账户信息 + /// + [AppService] + public class DiscussService : CrudAppService, + IDiscussService, IAutoApiService + { + public DiscussService(ICurrentUser currentUser) + { + _currentUser = currentUser; + } + [Autowired] + private ForumManager _forumManager { get; set; } + + [Autowired] + private IRepository _plateEntityRepository { get; set; } + + [Autowired] + private IDistributedEventBus _distributedEventBus { get; set; } + + //[Autowired] + private ICurrentUser _currentUser { get; set; } + /// + /// 单查 + /// + /// + /// + public async override Task GetAsync(long id) + { + + //查询主题发布 浏览主题 事件,浏览数+1 + var item = await _DbQueryable.LeftJoin((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) + { + _distributedEventBus.PublishAsync(new SeeDiscussEventArgs { DiscussId = item.Id, OldSeeNum = item.SeeNum }); + } + + return item; + } + + + /// + /// 查询 + /// + /// + /// + + public override async Task> GetListAsync([FromQuery] DiscussGetListInputVo input) + { + //需要关联创建者用户 + RefAsync 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((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().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(total, items); + } + + /// + /// 创建主题 + /// + /// + /// + public override async Task 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); + } + + + + + /// + /// 效验主题查询权限 + /// + /// + /// + /// + 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.私密); + } + } + } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/MyTypeService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/MyTypeService.cs new file mode 100644 index 00000000..ac557727 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/MyTypeService.cs @@ -0,0 +1,53 @@ +using Yi.BBS.Application.Contracts.Forum; +using Cike.AutoWebApi.Setting; +using Yi.BBS.Application.Contracts.Forum.Dtos; +using Yi.BBS.Domain.Forum.Entities; +using Yi.Framework.Ddd.Services; +using Yi.Framework.Core.CurrentUsers; +using SqlSugar; +using Yi.Framework.Ddd.Dtos; +using Yi.Framework.Data.Filters; + +namespace Yi.BBS.Application.Forum +{ + /// + /// Label服务实现 + /// + [AppService] + public class MyTypeService : CrudAppService, + ILabelService, IAutoApiService + { + [Autowired] + private ICurrentUser _currentUser { get; set; } + + [Autowired] + private IDataFilter _dataFilter { get; set; } + + /// + /// 获取当前用户的主题类型 + /// + /// + /// + public Task> GetListCurrentAsync(MyTypeGetListInputVo input) + { + + _dataFilter.AddFilter(x => x.UserId == _currentUser.Id); + return base.GetListAsync(input); + } + + /// + /// 创建 + /// + /// + /// + public override async Task 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); + } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/PlateService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/PlateService.cs new file mode 100644 index 00000000..43a67b8a --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Forum/PlateService.cs @@ -0,0 +1,18 @@ +using Yi.BBS.Application.Contracts.Forum; +using Cike.AutoWebApi.Setting; +using Yi.BBS.Application.Contracts.Forum.Dtos; +using Yi.BBS.Domain.Forum.Entities; +using Yi.Framework.Ddd.Services; +using Yi.BBS.Application.Contracts.Forum.Dtos.Plate; + +namespace Yi.BBS.Application.Forum +{ + /// + /// Plate服务实现 + /// + [AppService] + public class PlateService : CrudAppService, + IPlateService, IAutoApiService + { + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/GlobalSetting/SettingService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/GlobalSetting/SettingService.cs new file mode 100644 index 00000000..0e759e92 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/GlobalSetting/SettingService.cs @@ -0,0 +1,25 @@ +using Yi.BBS.Application.Contracts.GlobalSetting; +using Cike.AutoWebApi.Setting; +using Yi.BBS.Domain.GlobalSetting.Entities; +using Yi.Framework.Ddd.Services; + +namespace Yi.BBS.Application.GlobalSetting +{ + /// + /// Setting服务实现 + /// + [AppService] + public class SettingService : ApplicationService, + ISettingService, IAutoApiService + { + /// + /// 获取配置标题 + /// + /// + /// + public Task GetTitleAsync() + { + return Task.FromResult("你好世界"); + } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/GlobalSetting/TempService.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/GlobalSetting/TempService.cs new file mode 100644 index 00000000..803c8d3f --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/GlobalSetting/TempService.cs @@ -0,0 +1,81 @@ +using Yi.BBS.Application.Contracts.GlobalSetting; +using Cike.AutoWebApi.Setting; +using Yi.BBS.Domain.GlobalSetting.Entities; +using Yi.Framework.Ddd.Services; +using Microsoft.AspNetCore.Mvc; +using Yi.BBS.Application.Contracts.GlobalSetting.Dtos.Temp; +using Yi.BBS.Domain.Shared; +using Yi.Framework.Data.DataSeeds; +using Yi.RBAC.Domain.Identity.Entities; + +namespace Yi.BBS.Application.GlobalSetting +{ + /// + ///临时服务,之后用其他模块代替 + /// + [AppService] + public class TempService : ApplicationService, IAutoApiService + { + + public TempService() { + } + ///// + ///// 登录 + ///// + ///// + ///// + //[Route("/api/account/login")] + //public Task PostLoginAsync() + //{ + // bool loginSucces = true; + // if (!loginSucces) + // { + // throw new UserFriendlyException("登录失败", (int)BbsHttpStatusEnum.LoginFailed, "用户或者密码错误"); + // } + // var dto = new LoginDto("token"); + // dto.User = new LoginUserInfoDto { Icon = "", Id = 0, Level = 1, UserName = "橙子" }; + // return Task.FromResult(dto); + //} + + ///// + ///// 判断是否有登录 + ///// + ///// + //[Route("/api/account/logged")] + //public Task PostLogged() + //{ + // return Task.FromResult(true); + //} + + ///// + ///// 退出登录 + ///// + ///// + //[Route("/api/account/logout")] + //public Task PostlogOut() + //{ + // return Task.CompletedTask; + //} + + /// + /// 获取用户信息 + /// + /// + /// + [Route("/api/account/user/{id}")] + public Task> GetUserInfoByIdAsync(long id) + { + var dto = new List(); + dto.Add(new ActionJwtDto { Router = "/index", ActionName = "首页" }); + //dto.Add(new ActionJwtDto { Router = "/admLable", ActionName = "标签管理" }); + //dto.Add(new ActionJwtDto { Router = "", ActionName = "" }); + //dto.Add(new ActionJwtDto { Router = "", ActionName = "" }); + //dto.Add(new ActionJwtDto { Router = "", ActionName = "" }); + //dto.Add(new ActionJwtDto { Router = "", ActionName = "" }); + //dto.Add(new ActionJwtDto { Router = "", ActionName = "" }); + //dto.Add(new ActionJwtDto { Router = "", ActionName = "" }); + //dto.Add(new ActionJwtDto { Router = "", ActionName = "" }); + return Task.FromResult(dto); + } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Yi.BBS.ApplicationSwaggerDoc.xml b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Yi.BBS.ApplicationSwaggerDoc.xml new file mode 100644 index 00000000..0b2ebd1d --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Application/Yi.BBS.ApplicationSwaggerDoc.xml @@ -0,0 +1,163 @@ + + + + Yi.BBS.Application + + + + + 点赞功能 + + + + + 点赞,返回true为点赞+1,返回false为点赞-1 + + + + + + Banner服务实现 + + + + + Article服务实现 + + + + + 获取文章全部平铺信息 + + + + + + + + 查询文章 + + + + + + + + 发表文章 + + + + + + + + 效验创建权限 + + + + + + + 评论 + + + + + 获取改主题下的评论,结构为二维列表,该查询无分页 + + + + + + + + 发表评论 + + + + + + + + Discuss应用服务实现,用于参数效验、领域服务业务组合、日志记录、事务处理、账户信息 + + + + + 单查 + + + + + + + 查询 + + + + + + + 创建主题 + + + + + + + 效验主题查询权限 + + + + + + + + Label服务实现 + + + + + 获取当前用户的主题类型 + + + + + + + 创建 + + + + + + + Plate服务实现 + + + + + Setting服务实现 + + + + + 获取配置标题 + + + + + + + 临时服务,之后用其他模块代替 + + + + + 获取用户信息 + + + + + + diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain.Shared/Forum/EnumClasses/QueryDiscussTypeEnum.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/BbsHttpStatusEnum.cs similarity index 51% rename from Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain.Shared/Forum/EnumClasses/QueryDiscussTypeEnum.cs rename to Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/BbsHttpStatusEnum.cs index 08d9063a..565409f3 100644 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Domain.Shared/Forum/EnumClasses/QueryDiscussTypeEnum.cs +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/BbsHttpStatusEnum.cs @@ -4,13 +4,10 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Yi.BBS.Domain.Shared.Forum.EnumClasses +namespace Yi.BBS.Domain.Shared { - public enum QueryDiscussTypeEnum + public enum BbsHttpStatusEnum { - New, - Suggest, - Host - + LoginFailed=1900 } } diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain.Shared/School/ConstClasses/StudentConst.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Exhibition/ConstClasses/BannerConst.cs similarity index 69% rename from Yi.Framework.Net6/src/project/Template/Yi.Template.Domain.Shared/School/ConstClasses/StudentConst.cs rename to Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Exhibition/ConstClasses/BannerConst.cs index f22c18ed..1df938a8 100644 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain.Shared/School/ConstClasses/StudentConst.cs +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Exhibition/ConstClasses/BannerConst.cs @@ -4,13 +4,13 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace Yi.Template.Domain.Shared.School.ConstClasses +namespace Yi.BBS.Domain.Shared.Exhibition.ConstClasses { /// /// 常量定义 /// - public class StudentConst + public class BannerConst { } } diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/ArticleConst.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/ArticleConst.cs new file mode 100644 index 00000000..2f676c81 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/ArticleConst.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Domain.Shared.Forum.ConstClasses +{ + /// + /// 常量定义 + /// + + public class ArticleConst + { + public const string 文章不存在 = "传入的文章id不存在"; + + public const string 文章无权限 = "该文章无权限"; + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/CommentConst.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/CommentConst.cs new file mode 100644 index 00000000..c661d369 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/CommentConst.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Domain.Shared.Forum.ConstClasses +{ + /// + /// 常量定义 + /// + + public class CommentConst + { + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/DiscussConst.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/DiscussConst.cs new file mode 100644 index 00000000..99cad730 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/DiscussConst.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Domain.Shared.Forum.ConstClasses +{ + /// + /// 常量定义 + /// + + public class DiscussConst + { + public const string 主题不存在 = "传入的主题id不存在"; + + public const string 私密 = "【私密】您无该主题权限,可联系作者申请开放"; + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/LabelConst.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/LabelConst.cs new file mode 100644 index 00000000..e0fd6841 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/LabelConst.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Domain.Shared.Forum.ConstClasses +{ + /// + /// 常量定义 + /// + + public class LabelConst + { + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/PlateConst.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/PlateConst.cs new file mode 100644 index 00000000..92acf486 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain.Shared/Forum/ConstClasses/PlateConst.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.BBS.Domain.Shared.Forum.ConstClasses +{ + /// + /// 常量定义 + /// + + public class PlateConst + { + public const string 板块不存在 = "传入的板块id不存在"; + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Exhibition/Entities/BannerEntity.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Exhibition/Entities/BannerEntity.cs new file mode 100644 index 00000000..828fb743 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Exhibition/Entities/BannerEntity.cs @@ -0,0 +1,30 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Data.Auditing; +using Yi.Framework.Data.Entities; +using Yi.Framework.Ddd.Entities; + +namespace Yi.BBS.Domain.Exhibition.Entities +{ + [SugarTable("Banner")] + public class BannerEntity : IEntity, 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; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/ArticleEntity.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/ArticleEntity.cs new file mode 100644 index 00000000..f4700fb9 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/ArticleEntity.cs @@ -0,0 +1,63 @@ +using Microsoft.AspNetCore.Http; +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Data.Entities; +using Yi.Framework.Ddd.Entities; + +namespace Yi.BBS.Domain.Forum.Entities +{ + [SugarTable("Article")] + public class ArticleEntity : IEntity, 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 Children { get; set; } + } + + public static class ArticleEntityExtensions + { + /// + /// 平铺自己 + /// + /// + /// + public static List Tile(this List entities) + { + if(entities is null)return new List(); + var result = new List(); + return StartRecursion(entities, result); + } + + private static List StartRecursion(List entities, List 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; + } + + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/CommentEntity.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/CommentEntity.cs new file mode 100644 index 00000000..21372609 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/CommentEntity.cs @@ -0,0 +1,70 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Data.Auditing; +using Yi.Framework.Data.Entities; +using Yi.Framework.Ddd.Entities; +using Yi.RBAC.Domain.Identity.Entities; + +namespace Yi.BBS.Domain.Forum.Entities +{ + + /// + /// 评论表 + /// + [SugarTable("Comment")] + public class CommentEntity : IEntity, ISoftDelete,IAuditedObject + { + /// + /// 采用二维数组方式,不使用树形方式 + /// + public CommentEntity() + { + } + + internal 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; } + + /// + /// 被回复的CommentId + /// + public long ParentId { get; set; } + public DateTime CreationTime { get; set; } + + public long RootId { get; set; } + + [SugarColumn(IsIgnore = true)] + public List Children { get; set; } = new(); + + + /// + /// 用户,评论人用户信息 + /// + [Navigate(NavigateType.OneToOne, nameof(CreatorId))] + public UserEntity CreateUser { get; set; } + + /// + /// 被评论的用户信息 + /// + [SugarColumn(IsIgnore = true)] + public UserEntity CommentedUser { get; set; } + + public long? CreatorId { get; set; } + + public long? LastModifierId { get; set; } + + public DateTime? LastModificationTime { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/DiscussEntity.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/DiscussEntity.cs new file mode 100644 index 00000000..c14ecc64 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/DiscussEntity.cs @@ -0,0 +1,67 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Xml.Linq; +using Yi.BBS.Domain.Shared.Forum.EnumClasses; +using Yi.Framework.Data.Auditing; +using Yi.Framework.Data.Entities; +using Yi.Framework.Ddd.Entities; + +namespace Yi.BBS.Domain.Forum.Entities +{ + [SugarTable("Discuss")] + public class DiscussEntity : IEntity, 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; } + /// + /// 封面 + /// + 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; } + + + /// + /// 当PermissionType为部分用户时候,以下列表中的用户+创建者 代表拥有权限 + /// + [SugarColumn(IsJson = true)]//使用json处理 + public List? PermissionUserIds { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/DiscussMyTypeEntity.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/DiscussMyTypeEntity.cs new file mode 100644 index 00000000..56440647 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/DiscussMyTypeEntity.cs @@ -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.Ddd.Entities; + +namespace Yi.BBS.Domain.Forum.Entities +{ + [SugarTable("DiscussMyType")] + public class DiscussMyTypeEntity : IEntity + { + [SugarColumn(IsPrimaryKey = true)] + public long Id { get; set; } + + public long DiscussId { get; set; } + + public long MyTypeId { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/MyTypeEntity.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/MyTypeEntity.cs new file mode 100644 index 00000000..3dee5b65 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/MyTypeEntity.cs @@ -0,0 +1,25 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Data.Entities; +using Yi.Framework.Ddd.Entities; + +namespace Yi.BBS.Domain.Forum.Entities +{ + [SugarTable("MyType")] + public class MyTypeEntity : IEntity, 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; } + } +} diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain/School/Entities/StudentEntity.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/PlateEntity.cs similarity index 55% rename from Yi.Framework.Net6/src/project/Template/Yi.Template.Domain/School/Entities/StudentEntity.cs rename to Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/PlateEntity.cs index 61245c3e..f2901366 100644 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Domain/School/Entities/StudentEntity.cs +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Entities/PlateEntity.cs @@ -7,19 +7,17 @@ using System.Threading.Tasks; using Yi.Framework.Data.Entities; using Yi.Framework.Ddd.Entities; -namespace Yi.Template.Domain.School.Entities +namespace Yi.BBS.Domain.Forum.Entities { - [SugarTable("Student")] - public class StudentEntity : IEntity,ISoftDelete + [SugarTable("Plate")] + public class PlateEntity : IEntity, ISoftDelete { + [SugarColumn(IsPrimaryKey = true)] public long Id { get; set; } - public string Name { get; set; } - - public int? Height { get; set; } - - public string? Phone { get; set; } - public bool IsDeleted { get; set; } = false; + public string? Logo { get; set; } + public string? Introduction { get; set; } + public bool IsDeleted { get; set; } } } diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/ForumManager.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/ForumManager.cs new file mode 100644 index 00000000..1e713008 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/ForumManager.cs @@ -0,0 +1,48 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.BBS.Domain.Forum.Entities; +using Yi.BBS.Domain.Shared.Forum.ConstClasses; +using Yi.Framework.Ddd.Repositories; + +namespace Yi.BBS.Domain.Forum +{ + /// + /// 论坛模块的领域服务 + /// + [AppService] + public class ForumManager + { + private readonly IRepository _discussRepository; + private readonly IRepository _plateEntityRepository; + private readonly IRepository _commentRepository; + public ForumManager(IRepository discussRepository, IRepository plateEntityRepository, IRepository commentRepository) + { + _discussRepository = discussRepository; + _plateEntityRepository = plateEntityRepository; + _commentRepository = commentRepository; + } + + //主题是不能直接创建的,需要由领域服务统一创建 + public async Task 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 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); + } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Repositories/IArticleRepository.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Repositories/IArticleRepository.cs new file mode 100644 index 00000000..c8056a9f --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Forum/Repositories/IArticleRepository.cs @@ -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.BBS.Domain.Forum.Entities; +using Yi.Framework.Ddd.Repositories; + +namespace Yi.BBS.Domain.Forum.Repositories +{ + public interface IArticleRepository:IRepository + { + Task> GetTreeAsync(Expression> where); + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/GlobalSetting/Entities/SettingEntity.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/GlobalSetting/Entities/SettingEntity.cs new file mode 100644 index 00000000..69433035 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/GlobalSetting/Entities/SettingEntity.cs @@ -0,0 +1,24 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Data.Entities; +using Yi.Framework.Ddd.Entities; + +namespace Yi.BBS.Domain.GlobalSetting.Entities +{ + [SugarTable("Setting")] + public class SettingEntity : IEntity + { + + [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; } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Yi.BBS.DomainSwaggerDoc.xml b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Yi.BBS.DomainSwaggerDoc.xml new file mode 100644 index 00000000..1882b0e9 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Domain/Yi.BBS.DomainSwaggerDoc.xml @@ -0,0 +1,65 @@ + + + + Yi.BBS.Domain + + + + + 主题id + + + + + 创建者 + + + + + 平铺自己 + + + + + + + 评论表 + + + + + 采用二维数组方式,不使用树形方式 + + + + + 被回复的CommentId + + + + + 用户,评论人用户信息 + + + + + 被评论的用户信息 + + + + + 封面 + + + + + 当PermissionType为部分用户时候,以下列表中的用户+创建者 代表拥有权限 + + + + + 论坛模块的领域服务 + + + + diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Sqlsugar/Repositories/ArticleRepository.cs b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Sqlsugar/Repositories/ArticleRepository.cs new file mode 100644 index 00000000..0b23a30a --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Sqlsugar/Repositories/ArticleRepository.cs @@ -0,0 +1,27 @@ +using SqlSugar; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Expressions; +using System.Text; +using System.Threading.Tasks; +using Yi.BBS.Domain.Forum.Entities; +using Yi.BBS.Domain.Forum.Repositories; +using Yi.Framework.Core.Sqlsugar.Repositories; +using Yi.Framework.Ddd.Repositories; + +namespace Yi.BBS.Sqlsugar.Repositories +{ + [AppService] + public class ArticleRepository : SqlsugarRepository, IArticleRepository + { + public ArticleRepository(ISqlSugarClient context) : base(context) + { + } + + public async Task> GetTreeAsync(Expression> where) + { + return await _DbQueryable.Where(where).ToTreeAsync(x => x.Children, x => x.ParentId, 0); + } + } +} diff --git a/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/.config/dotnet-tools.json b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/.config/dotnet-tools.json new file mode 100644 index 00000000..3aca4744 --- /dev/null +++ b/Yi.Framework.Net6/src/project/bbs/Yi.BBS.Web/.config/dotnet-tools.json @@ -0,0 +1,12 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "7.0.4", + "commands": [ + "dotnet-ef" + ] + } + } +} \ No newline at end of file diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentCreateInputVo.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentCreateInputVo.cs new file mode 100644 index 00000000..749e9f76 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentCreateInputVo.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Template.Application.Contracts.School.Dtos +{ + /// + /// Student输入创建对象 + /// + public class StudentCreateInputVo + { + public string Name { get; set; } + public int? Height { get; set; } + public string? Phone { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetListInputVo.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetListInputVo.cs new file mode 100644 index 00000000..2dc834cc --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetListInputVo.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Yi.Framework.Ddd.Dtos; + +namespace Yi.Template.Application.Contracts.School.Dtos +{ + public class StudentGetListInputVo : PagedAndSortedResultRequestDto + { + public string Name { get; set; } + public int? Height { get; set; } + public string? Phone { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetOutputDto.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetListOutputDto.cs similarity index 86% rename from Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetOutputDto.cs rename to Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetListOutputDto.cs index 22afda93..009102ba 100644 --- a/Yi.Framework.Net6/src/project/Template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetOutputDto.cs +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentGetListOutputDto.cs @@ -7,7 +7,7 @@ using Yi.Framework.Ddd.Dtos; namespace Yi.Template.Application.Contracts.School.Dtos { - public class StudentGetOutputDto : IEntityDto + public class StudentGetListOutputDto : IEntityDto { public long Id { get; set; } public string Name { get; set; } diff --git a/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentUpdateInputVo.cs b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentUpdateInputVo.cs new file mode 100644 index 00000000..4121fbb6 --- /dev/null +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Application.Contracts/School/Dtos/Student/StudentUpdateInputVo.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Template.Application.Contracts.School.Dtos +{ + public class StudentUpdateInputVo + { + public string Name { get; set; } + public int? Height { get; set; } + public string? Phone { get; set; } + } +} diff --git a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/nlog.config b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/nlog.config similarity index 97% rename from Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/nlog.config rename to Yi.Framework.Net6/src/project/template/Yi.Template.Web/nlog.config index d4224b1a..8d73d112 100644 --- a/Yi.Framework.Net6/src/project/BBS/Yi.BBS.Web/nlog.config +++ b/Yi.Framework.Net6/src/project/template/Yi.Template.Web/nlog.config @@ -42,7 +42,7 @@ - +