style: 修改大小写问题

This commit is contained in:
陈淳
2023-04-15 14:01:50 +08:00
parent ef5b628b31
commit c4f25b7a41
128 changed files with 2484 additions and 1681 deletions

View File

@@ -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;

View File

@@ -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; }
}
}

View File

@@ -1,23 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<DocumentationFile>./$(AssemblyName)SwaggerDoc.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\rbac\Yi.RBAC.Application.Contracts\Yi.RBAC.Application.Contracts.csproj" />
<ProjectReference Include="..\Yi.BBS.Domain.Shared\Yi.BBS.Domain.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="Yi.BBS.Application.ContractsSwaggerDoc.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -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)
{
}
}
}

View File

@@ -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
{
/// <summary>
/// 点赞功能
/// </summary>
[AppService]
public class AgreeService : ApplicationService, IApplicationService, IAutoApiService
{
[Autowired]
private IRepository<AgreeEntity> _repository { get; set; }
[Autowired]
private IRepository<DiscussEntity> _discssRepository { get; set; }
[Autowired]
private ICurrentUser _currentUser { get; set; }
[Autowired]
private IUnitOfWorkManager _unitOfWorkManager { get; set; }
/// <summary>
/// 点赞,返回true为点赞+1返回false为点赞-1
/// </summary>
/// <returns></returns>
public async Task<AgreeDto> 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);
}
}
}
}

View File

@@ -1,26 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<DocumentationFile>./$(AssemblyName)SwaggerDoc.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.Auth.JwtBearer\Yi.Framework.Auth.JwtBearer.csproj" />
<ProjectReference Include="..\..\..\framework\Yi.Framework.Uow\Yi.Framework.Uow.csproj" />
<ProjectReference Include="..\..\rbac\Yi.RBAC.Application\Yi.RBAC.Application.csproj" />
<ProjectReference Include="..\Yi.BBS.Application.Contracts\Yi.BBS.Application.Contracts.csproj" />
<ProjectReference Include="..\Yi.BBS.Domain\Yi.BBS.Domain.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="Yi.BBS.ApplicationSwaggerDoc.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -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)
{
}
}
}

View File

@@ -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
{
/// <summary>
/// 默认:公开
/// </summary>
Public = 0,
/// <summary>
/// 仅自己可见
/// </summary>
Oneself,
/// <summary>
/// 部分用户可见
/// </summary>
User
}
}

View File

@@ -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; }
}
}

View File

@@ -1,15 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.Ddd\Yi.Framework.Ddd.csproj" />
</ItemGroup>
</Project>

View File

@@ -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)
{
}
}
}

View File

@@ -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<ConfigEntity>
{
public BbsConfigDataSeed(IRepository<ConfigEntity> repository) : base(repository)
{
}
public override async Task<bool> IsInvoker()
{
return !await _repository.IsAnyAsync(x => x.ConfigKey == "bbs.site.name");
}
public override List<ConfigEntity> GetSeedData()
{
List<ConfigEntity> entities = new List<ConfigEntity>()
{
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;
}
}
}

View File

@@ -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<MenuEntity>
{
public BbsMenuDataSeed(IRepository<MenuEntity> repository) : base(repository)
{
}
public override async Task<bool> IsInvoker()
{
return !await _repository.IsAnyAsync(x => x.MenuName == "BBS");
}
public override List<MenuEntity> GetSeedData()
{
List<MenuEntity> entities = new List<MenuEntity>();
//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;
}
}
}

View File

@@ -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<long>, ICreationAuditedObject
{
public AgreeEntity()
{
}
public AgreeEntity(long discussId)
{
DiscussId = discussId;
}
[SugarColumn(IsPrimaryKey = true)]
public long Id { get; set; } = SnowflakeHelper.NextId;
public DateTime CreationTime { get; set; }
/// <summary>
/// 主题id
/// </summary>
public long DiscussId { get; set; }
/// <summary>
/// 创建者
/// </summary>
public long? CreatorId { get; set; }
}
}

View File

@@ -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<SeeDiscussEventArgs>
{
private IRepository<DiscussEntity> _repository;
public SeeDiscussEventHandler(IRepository<DiscussEntity> 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);
}
}
}
}

View File

@@ -1,24 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<DocumentationFile>./$(AssemblyName)SwaggerDoc.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.Data\Yi.Framework.Data.csproj" />
<ProjectReference Include="..\..\rbac\Yi.RBAC.Domain\Yi.RBAC.Domain.csproj" />
<ProjectReference Include="..\Yi.BBS.Domain.Shared\Yi.BBS.Domain.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="Yi.BBS.DomainSwaggerDoc.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -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)
{
}
}
}

View File

@@ -1,18 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.Core.Sqlsugar\Yi.Framework.Core.Sqlsugar.csproj" />
<ProjectReference Include="..\..\rbac\Yi.RBAC.Sqlsugar\Yi.RBAC.Sqlsugar.csproj" />
<ProjectReference Include="..\Yi.BBS.Domain\Yi.BBS.Domain.csproj" />
</ItemGroup>
</Project>

View File

@@ -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<IStudentRepository, StudentRepository>();
}
}
}

View File

@@ -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<ISqlSugarClient>();
app.UseErrorHandlingServer();
app.UseAuthentication();
app.UseAuthorization();
app.MapControllers();
app.Run();

View File

@@ -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"
}
}
}
}

View File

@@ -1,52 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.BBS.Application\Yi.BBS.Application.csproj" />
<ProjectReference Include="..\Yi.BBS.Sqlsugar\Yi.BBS.Sqlsugar.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="appsettings.Production.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.Development.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Update="nlog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Update="ip2region.db">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="key.pem">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="public.pem">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="yi-sqlsugar-dev.db">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
</Project>

View File

@@ -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<YiBBSApplicationModule>();
}
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
{
//if (app.Environment.IsDevelopment())
{
app.UseSwaggerServer();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.UseRouting();
}
}
}

View File

@@ -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
}
}

View File

@@ -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-----

View File

@@ -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-----

View File

@@ -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;

View File

@@ -1,18 +0,0 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.Template.Application.Contracts</name>
</assembly>
<members>
<member name="T:Yi.Template.Application.Contracts.School.Dtos.StudentCreateInputVo">
<summary>
Student输入创建对象
</summary>
</member>
<member name="T:Yi.Template.Application.Contracts.School.IStudentService">
<summary>
Student
</summary>
</member>
</members>
</doc>

View File

@@ -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
{
/// <summary>
/// Student
/// </summary>
public interface IStudentService : ICrudAppService<StudentGetOutputDto, StudentGetListOutputDto, long, StudentGetListInputVo, StudentCreateInputVo, StudentUpdateInputVo>
{
}
}

View File

@@ -1,23 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<DocumentationFile>./ApplicationContractsSwaggerDoc.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Template.Domain.Shared\Yi.Template.Domain.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="ApplicationContractsSwaggerDoc.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -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)
{
}
}
}

View File

@@ -1,13 +0,0 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Yi.Template.Application</name>
</assembly>
<members>
<member name="T:Yi.Template.Application.School.StudentService">
<summary>
Student服务实现
</summary>
</member>
</members>
</doc>

View File

@@ -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
{
/// <summary>
/// Student服务实现
/// </summary>
[AppService]
public class StudentService : CrudAppService<StudentEntity, StudentGetOutputDto, StudentGetListOutputDto, long, StudentGetListInputVo, StudentCreateInputVo, StudentUpdateInputVo>,
IStudentService, IAutoApiService
{
}
}

View File

@@ -1,25 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<DocumentationFile>./ApplicationSwaggerDoc.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.Auth.JwtBearer\Yi.Framework.Auth.JwtBearer.csproj" />
<ProjectReference Include="..\..\..\framework\Yi.Framework.Uow\Yi.Framework.Uow.csproj" />
<ProjectReference Include="..\Yi.Template.Application.Contracts\Yi.Template.Application.Contracts.csproj" />
<ProjectReference Include="..\Yi.Template.Domain\Yi.Template.Domain.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="ApplicationSwaggerDoc.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -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)
{
}
}
}

View File

@@ -1,15 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.Ddd\Yi.Framework.Ddd.csproj" />
</ItemGroup>
</Project>

View File

@@ -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)
{
}
}
}

View File

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

View File

@@ -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<StudentEntity>
{
public StudentDataSeed(IRepository<StudentEntity> repository) : base(repository)
{
}
public override List<StudentEntity> GetSeedData()
{
return new List<StudentEntity>() { 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 }
};
}
}
}

View File

@@ -1,24 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<DocumentationFile>./DomainSwaggerDoc.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.Data\Yi.Framework.Data.csproj" />
<ProjectReference Include="..\Yi.Template.Domain.Shared\Yi.Template.Domain.Shared.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="DomainSwaggerDoc.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -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<StudentManager>();
}
}
}

View File

@@ -1,17 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\framework\Yi.Framework.Core.Sqlsugar\Yi.Framework.Core.Sqlsugar.csproj" />
<ProjectReference Include="..\Yi.Template.Domain\Yi.Template.Domain.csproj" />
</ItemGroup>
</Project>

View File

@@ -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<IStudentRepository, StudentRepository>();
}
}
}

View File

@@ -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();

View File

@@ -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"
}
}
}
}

View File

@@ -1,33 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Yi.Template.Application\Yi.Template.Application.csproj" />
<ProjectReference Include="..\Yi.Template.Sqlsugar\Yi.Template.Sqlsugar.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="nlog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Update="key.pem">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="public.pem">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@@ -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<YiTemplateApplicationModule>();
}
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
{
//if (app.Environment.IsDevelopment())
{
app.UseSwaggerServer();
}
app.UseHttpsRedirection();
app.UseAuthorization();
app.UseRouting();
}
}
}

View File

@@ -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
}

View File

@@ -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-----

View File

@@ -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-----

View File

@@ -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
{
/// <summary>
/// Banner输入创建对象
/// </summary>
public class BannerCreateInputVo
{
public string Name { get; set; }
public string? Logo { get; set; }
public string? Color { get; set; }
}
}

View File

@@ -0,0 +1,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; }
}
}

View File

@@ -0,0 +1,21 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.Framework.Ddd.Dtos;
namespace Yi.BBS.Application.Contracts.Exhibition.Dtos.Banner
{
public class BannerGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public string Name { get; set; }
public string? Logo { get; set; }
public string? Color { get; set; }
public DateTime CreationTime { get; set; }
}
}

View File

@@ -0,0 +1,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<long>
{
public long Id { get; set; }
public string Name { get; set; }
public string? Logo { get; set; }
public string? Color { get; set; }
public DateTime CreationTime { get; set; }
}
}

View File

@@ -0,0 +1,15 @@
using 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; }
}
}

View File

@@ -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
{
/// <summary>
/// Banner抽象
/// </summary>
public interface IBannerService : ICrudAppService<BannerGetOutputDto, BannerGetListOutputDto, long, BannerGetListInputVo, BannerCreateInputVo, BannerUpdateInputVo>
{
}
}

View File

@@ -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<long>
{
public long Id { get; set; }
//批量查询,不给内容,性能考虑
//public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public long ParentId { get; set; }
public List<ArticleAllOutputDto> Children { get; set; }
}
}

View File

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

View File

@@ -0,0 +1,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; }
}
}

View File

@@ -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<long>
{
public long Id { get; set; }
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD>
//public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public List<ArticleGetListOutputDto> Children { get; set; }
}
}

View File

@@ -0,0 +1,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<long>
{
public long Id { get; set; }
public string Content { get; set; }
public string Name { get; set; }
public long DiscussId { get; set; }
public long ParentId { get; set; }
}
}

View File

@@ -0,0 +1,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; }
}
}

View File

@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;
namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
/// <summary>
/// Comment输入创建对象
/// </summary>
public class CommentCreateInputVo
{
/// <summary>
/// 评论id
/// </summary>
public string Content { get; set; }
/// <summary>
/// 主题id
/// </summary>
public long DiscussId { get; set; }
/// <summary>
/// 第一层评论id第一层为0
/// </summary>
public long RootId { get; set; }
/// <summary>
/// 被回复的CommentId第一层为0
/// </summary>
public long ParentId { get; set; }
}
}

View File

@@ -0,0 +1,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; }
//Ӧ<><D3A6>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ī<EFBFBD><C4AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ
public long? DiscussId { get; set; }
}
}

View File

@@ -0,0 +1,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
{
/// <summary>
/// <20><><EFBFBD>۶෴
/// </summary>
public class CommentGetListOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public DateTime? CreationTime { get; set; }
public string Content { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD>id
/// </summary>
public long DiscussId { get; set; }
public long ParentId { get; set; }
public long RootId { get; set; }
/// <summary>
/// <20>û<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>Ϣ
/// </summary>
public UserGetOutputDto CreateUser { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD>۵<EFBFBD><DBB5>û<EFBFBD><C3BB><EFBFBD>Ϣ
/// </summary>
public UserGetOutputDto CommentedUser { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>Σ<EFBFBD><CEA3><EFBFBD><EFBFBD>Ǵ<EFBFBD><C7B4><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ά<EFBFBD><CEAC><EFBFBD><EFBFBD><E9A3AC>Childrenֻ<6E><D6BB><EFBFBD>ڶ<EFBFBD><DAB6><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB>һ<EFBFBD><D2BB>
/// </summary>
public List<CommentGetListOutputDto> Children { get; set; } = new List<CommentGetListOutputDto>();
}
}

View File

@@ -0,0 +1,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
{
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD>أ<EFBFBD><D8A3><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۼ<EFBFBD><DBBC><EFBFBD>
/// </summary>
public class CommentGetOutputDto : IEntityDto<long>
{
public long Id { get; set; }
public DateTime? CreateTime { get; set; }
public string Content { get; set; }
public long DiscussId { get; set; }
/// <summary>
/// <20>û<EFBFBD>id<69><64><EFBFBD><EFBFBD>Ϊ<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
public UserGetOutputDto User { get; set; }
/// <summary>
/// <20><><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>id
/// </summary>
public long RootId { get; set; }
/// <summary>
/// <20><><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>CommentId
/// </summary>
public long ParentId { get; set; }
}
}

View File

@@ -0,0 +1,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; }
//<2F><><EFBFBD>²<EFBFBD><C2B2>ܽ<EFBFBD><DCBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
}
}

View File

@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Yi.BBS.Domain.Shared.Forum.EnumClasses;
namespace Yi.BBS.Application.Contracts.Forum.Dtos.Discuss
{
/// <summary>
/// Discuss输入创建对象
/// </summary>
public class DiscussCreateInputVo
{
public string Title { get; set; }
public string? Types { get; set; }
public string? Introduction { get; set; }
public DateTime? CreateTime { get; set; } = DateTime.Now;
public string Content { get; set; }
public string? Color { get; set; }
public long PlateId { get; set; }
/// <summary>
/// 默认公开
/// </summary>
public DiscussPermissionTypeEnum PermissionType { get; set; } = DiscussPermissionTypeEnum.Public;
/// <summary>
/// 封面
/// </summary>
public string? Cover { get; set; }
}
}

View File

@@ -0,0 +1,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; }
//Ĭ<>ϲ<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD>ö<EFBFBD>
public bool IsTop { get; set; } = false;
//<2F><>ѯ<EFBFBD><D1AF>ʽ
public QueryDiscussTypeEnum Type { get; set; } = QueryDiscussTypeEnum.New;
}
}

View File

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

View File

@@ -0,0 +1,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<long>
{
public long Id { get; set; }
public string Title { get; set; }
public string? Types { get; set; }
public string? Introduction { get; set; }
public int AgreeNum { get; set; }
public int SeeNum { get; set; }
public string Content { get; set; }
public string? Color { get; set; }
public long PlateId { get; set; }
//<2F>Ƿ<EFBFBD><C7B7>ö<EFBFBD><C3B6><EFBFBD>Ĭ<EFBFBD><C4AC>false
public bool IsTop { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD>
/// </summary>
public string? Cover { get; set; }
//<2F>Ƿ<EFBFBD>˽<EFBFBD>У<EFBFBD>Ĭ<EFBFBD><C4AC>false
public bool IsPrivate { get; set; }
//˽<><CBBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ж<EFBFBD>codeȨ<65><C8A8>
public string? PrivateCode { get; set; }
public DateTime CreationTime { get; set; }
public DiscussPermissionTypeEnum PermissionType { get; set; }
public List<long> PermissionUserIds { get; set; }
public UserGetListOutputDto User { get; set; }
}
}

View File

@@ -0,0 +1,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<long> PermissionUserIds { get; set; }
public DiscussPermissionTypeEnum PermissionType { get; set; }
/// <summary>
/// <20><><EFBFBD><EFBFBD>
/// </summary>
public string? Cover { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.BBS.Application.Contracts.Forum.Dtos
{
/// <summary>
/// Label输入创建对象
/// </summary>
public class MyTypeCreateInputVo
{
public string Name { get; set; }
public string? Color { get; set; }
public string? BackgroundColor { get; set; }
}
}

View File

@@ -0,0 +1,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; }
}
}

View File

@@ -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<long>
{
public long Id { get; set; }
public string Name { get; set; }
public string? Color { get; set; }
public string? BackgroundColor { get; set; }
public long UserId { get; set; }
}
}

View File

@@ -0,0 +1,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<long>
{
public long Id { get; set; }
public string Name { get; set; }
public string? Color { get; set; }
public string? BackgroundColor { get; set; }
public long UserId { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.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; }
}
}

View File

@@ -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
{
/// <summary>
/// Plate输入创建对象
/// </summary>
public class PlateCreateInputVo
{
public long Id { get; set; }
public string Name { get; set; }
public string? Logo { get; set; }
public string? Introduction { get; set; }
}
}

View File

@@ -0,0 +1,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; }
}
}

View File

@@ -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<long>
{
public long Id { get; set; }
public string Name { get; set; }
public string? Logo { get; set; }
public string? Introduction { get; set; }
}
}

View File

@@ -0,0 +1,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<long>
{
public long Id { get; set; }
public string Name { get; set; }
public string? Logo { get; set; }
public string? Introduction { get; set; }
}
}

View File

@@ -0,0 +1,18 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.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; }
}
}

View File

@@ -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
{
/// <summary>
/// Article服务抽象
/// </summary>
public interface IArticleService : ICrudAppService<ArticleGetOutputDto, ArticleGetListOutputDto, long, ArticleGetListInputVo, ArticleCreateInputVo, ArticleUpdateInputVo>
{
}
}

View File

@@ -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
{
/// <summary>
/// Comment服务抽象
/// </summary>
public interface ICommentService : ICrudAppService<CommentGetOutputDto, CommentGetListOutputDto, long, CommentGetListInputVo, CommentCreateInputVo, CommentUpdateInputVo>
{
}
}

View File

@@ -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
{
/// <summary>
/// Discuss服务抽象
/// </summary>
public interface IDiscussService : ICrudAppService<DiscussGetOutputDto, DiscussGetListOutputDto, long, DiscussGetListInputVo, DiscussCreateInputVo, DiscussUpdateInputVo>
{
Task VerifyDiscussPermissionAsync(long discussId);
}
}

View File

@@ -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
{
/// <summary>
/// Label服务抽象
/// </summary>
public interface ILabelService : ICrudAppService<MyTypeOutputDto, MyTypeGetListOutputDto, long, MyTypeGetListInputVo, MyTypeCreateInputVo, MyTypeUpdateInputVo>
{
}
}

View File

@@ -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
{
/// <summary>
/// Plate服务抽象
/// </summary>
public interface IPlateService : ICrudAppService<PlateGetOutputDto, PlateGetListOutputDto, long, PlateGetListInputVo, PlateCreateInputVo, PlateUpdateInputVo>
{
}
}

View File

@@ -0,0 +1,18 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Yi.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; }
}
}

View File

@@ -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; }
}
}

View File

@@ -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
{
/// <summary>
/// Setting应用抽象
/// </summary>
public interface ISettingService : IApplicationService
{
/// <summary>
/// 获取配置标题
/// </summary>
/// <returns></returns>
Task<string> GetTitleAsync();
}
}

View File

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

View File

@@ -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
{
/// <summary>
/// Banner服务实现
/// </summary>
[AppService]
public class BannerService : CrudAppService<BannerEntity, BannerGetOutputDto, BannerGetListOutputDto, long, BannerGetListInputVo, BannerCreateInputVo, BannerUpdateInputVo>,
IBannerService, IAutoApiService
{
}
}

View File

@@ -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
{
/// <summary>
/// Article服务实现
/// </summary>
[AppService]
public class ArticleService : CrudAppService<ArticleEntity, ArticleGetOutputDto, ArticleGetListOutputDto, long, ArticleGetListInputVo, ArticleCreateInputVo, ArticleUpdateInputVo>,
IArticleService, IAutoApiService
{
[Autowired]
private IArticleRepository _articleRepository { get; set; }
[Autowired]
private IRepository<DiscussEntity> _discussRepository { get; set; }
[Autowired]
private ICurrentUser _currentUser { get; set; }
[Autowired]
private IDiscussService _discussService { get; set; }
/// <summary>
/// 获取文章全部平铺信息
/// </summary>
/// <param name="discussId"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
[Route("/api/article/all/discuss-id/{discussId}")]
public async Task<List<ArticleAllOutputDto>> GetAllAsync([FromRoute] long discussId)
{
await _discussService.VerifyDiscussPermissionAsync(discussId);
var entities = await _articleRepository.GetTreeAsync(x => x.DiscussId == discussId);
//var result = entities.Tile();
var items = _mapper.Map<List<ArticleAllOutputDto>>(entities);
return items;
}
/// <summary>
/// 查询文章
/// </summary>
/// <param name="discussId"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
public async Task<List<ArticleGetListOutputDto>> GetDiscussIdAsync([FromRoute] long discussId)
{
if (!await _discussRepository.IsAnyAsync(x => x.Id == discussId))
{
throw new UserFriendlyException(DiscussConst.);
}
var entities = await _articleRepository.GetTreeAsync(x => x.DiscussId == discussId);
var items = await MapToGetListOutputDtosAsync(entities);
return items;
}
/// <summary>
/// 发表文章
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
public async override Task<ArticleGetOutputDto> CreateAsync(ArticleCreateInputVo input)
{
var discuss = await _discussRepository.GetFirstAsync(x => x.Id == input.DiscussId);
if (discuss is null)
{
throw new UserFriendlyException(DiscussConst.);
}
if (input.ParentId != 0 && !await _repository.IsAnyAsync(x => x.Id == input.ParentId))
{
throw new UserFriendlyException(ArticleConst.);
}
await VerifyDiscussCreateIdAsync(discuss.CreatorId);
return await base.CreateAsync(input);
}
/// <summary>
/// 效验创建权限
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public async Task VerifyDiscussCreateIdAsync(long? userId)
{
//只有文章是特殊的,不能在其他主题下创建
//主题的创建者不是当前用户,同时,没有权限或者超级管理
//false & true & false ,三个条件任意满意一个,即可成功使用||,最后取反,一个都不满足
//
if (userId != _currentUser.Id && !UserConst.Admin.Equals( _currentUser.UserName)&& !_currentUser.Permission.Contains("bbs:discuss:add"))
{
throw new UserFriendlyException("无权限在其他用户主题中创建子文章");
}
}
}
}

View File

@@ -0,0 +1,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
{
/// <summary>
/// 评论
/// </summary>
[AppService]
public class CommentService : CrudAppService<CommentEntity, CommentGetOutputDto, CommentGetListOutputDto, long, CommentGetListInputVo, CommentCreateInputVo, CommentUpdateInputVo>,
ICommentService, IAutoApiService
{
[Autowired]
private ForumManager _forumManager { get; set; }
[Autowired]
private ICurrentUser _currentUser { get; set; }
[Autowired]
private IRepository<DiscussEntity> _discussRepository { get; set; }
[Autowired]
private IDiscussService _discussService { get; set; }
/// <summary>
/// 获取改主题下的评论,结构为二维列表,该查询无分页
/// </summary>
/// <param name="discussId"></param>
/// <param name="input"></param>
/// <returns></returns>
public async Task<PagedResultDto<CommentGetListOutputDto>> GetDiscussIdAsync([FromRoute] long discussId, [FromQuery] CommentGetListInputVo input)
{
await _discussService.VerifyDiscussPermissionAsync(discussId);
var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.Content), x => x.Content.Contains(input.Content))
.Where(x => x.DiscussId == discussId)
.Includes(x=>x.CreateUser)
.ToListAsync();
//结果初始值,第一层等于全部根节点
var outPut = entities.Where(x => x.ParentId == 0).OrderByDescending(x=>x.CreationTime).ToList();
//将全部数据进行hash
var dic = entities.ToDictionary(x => x.Id);
foreach (var comment in entities)
{
//不是根节点,需要赋值 被评论者用户信息等
if (comment.ParentId != 0)
{
var parentComment = dic[comment.ParentId];
comment.CommentedUser = parentComment.CreateUser;
}
//root或者parent id根节点都是等于0的
var id = comment.RootId;
if (id is not 0)
{
dic[id].Children.Add(comment);
}
}
//子类需要排序
outPut.ForEach(x =>
{
x.Children = x.Children.OrderByDescending(x => x.CreationTime).ToList();
});
//获取全量主题评论, 先获取顶级的,将其他子组合到顶级下,形成一个二维,先转成dto
List<CommentGetListOutputDto>? items = await MapToGetListOutputDtosAsync(outPut);
return new PagedResultDto<CommentGetListOutputDto>(entities.Count(), items);
}
/// <summary>
/// 发表评论
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
public override async Task<CommentGetOutputDto> CreateAsync(CommentCreateInputVo input)
{
if (!await _discussRepository.IsAnyAsync(x => x.Id == input.DiscussId))
{
throw new UserFriendlyException(DiscussConst.);
}
var entity = await _forumManager.CreateCommentAsync(input.DiscussId, input.ParentId,input.RootId, input.Content);
return await MapToGetOutputDtoAsync(entity);
}
}
}

View File

@@ -0,0 +1,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
{
/// <summary>
/// Discuss应用服务实现,用于参数效验、领域服务业务组合、日志记录、事务处理、账户信息
/// </summary>
[AppService]
public class DiscussService : CrudAppService<DiscussEntity, DiscussGetOutputDto, DiscussGetListOutputDto, long, DiscussGetListInputVo, DiscussCreateInputVo, DiscussUpdateInputVo>,
IDiscussService, IAutoApiService
{
public DiscussService(ICurrentUser currentUser)
{
_currentUser = currentUser;
}
[Autowired]
private ForumManager _forumManager { get; set; }
[Autowired]
private IRepository<PlateEntity> _plateEntityRepository { get; set; }
[Autowired]
private IDistributedEventBus _distributedEventBus { get; set; }
//[Autowired]
private ICurrentUser _currentUser { get; set; }
/// <summary>
/// 单查
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async override Task<DiscussGetOutputDto> GetAsync(long id)
{
//查询主题发布 浏览主题 事件,浏览数+1
var item = await _DbQueryable.LeftJoin<UserEntity>((discuss, user) => discuss.CreatorId == user.Id)
.Select((discuss, user) => new DiscussGetOutputDto
{
User = new UserGetListOutputDto() { UserName = user.UserName, Nick = user.Nick, Icon = user.Icon }
}, true).SingleAsync(discuss => discuss.Id == id);
await VerifyDiscussPermissionAsync(item.Id);
if (item is not null)
{
_distributedEventBus.PublishAsync(new SeeDiscussEventArgs { DiscussId = item.Id, OldSeeNum = item.SeeNum });
}
return item;
}
/// <summary>
/// 查询
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public override async Task<PagedResultDto<DiscussGetListOutputDto>> GetListAsync([FromQuery] DiscussGetListInputVo input)
{
//需要关联创建者用户
RefAsync<int> total = 0;
var items = await _DbQueryable
.WhereIF(!string.IsNullOrEmpty(input.Title), x => x.Title.Contains(input.Title))
.WhereIF(input.PlateId is not null, x => x.PlateId == input.PlateId)
.Where(x => x.IsTop == input.IsTop)
.LeftJoin<UserEntity>((discuss, user) => discuss.CreatorId == user.Id)
.OrderByIF(input.Type == QueryDiscussTypeEnum.New, discuss => discuss.CreationTime, OrderByType.Desc)
.OrderByIF(input.Type == QueryDiscussTypeEnum.Host, discuss => discuss.SeeNum, OrderByType.Desc)
.OrderByIF(input.Type == QueryDiscussTypeEnum.Suggest, discuss => discuss.AgreeNum, OrderByType.Desc)
.Select((discuss, user) => new DiscussGetListOutputDto
{
Id=discuss.Id,
IsAgree = SqlFunc.Subqueryable<AgreeEntity>().Where(x => x.CreatorId == _currentUser.Id && x.DiscussId == discuss.Id).Any(),
User = new UserGetListOutputDto() { Id=user.Id, UserName = user.UserName, Nick = user.Nick, Icon = user.Icon }
}, true)
.ToPageListAsync(input.PageNum, input.PageSize, total);
//查询完主题之后,要过滤一下私有的主题信息
items.ApplyPermissionTypeFilter(_currentUser.Id);
return new PagedResultDto<DiscussGetListOutputDto>(total, items);
}
/// <summary>
/// 创建主题
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public override async Task<DiscussGetOutputDto> CreateAsync(DiscussCreateInputVo input)
{
if (!await _plateEntityRepository.IsAnyAsync(x => x.Id == input.PlateId))
{
throw new UserFriendlyException(PlateConst.);
}
var entity = await _forumManager.CreateDiscussAsync(await MapToEntityAsync(input));
return await MapToGetOutputDtoAsync(entity);
}
/// <summary>
/// 效验主题查询权限
/// </summary>
/// <param name="discussId"></param>
/// <returns></returns>
/// <exception cref="UserFriendlyException"></exception>
public async Task VerifyDiscussPermissionAsync(long discussId)
{
var discuss = await _repository.GetFirstAsync(x => x.Id == discussId);
if (discuss is null)
{
throw new UserFriendlyException(DiscussConst.);
}
if (discuss.PermissionType == DiscussPermissionTypeEnum.Oneself)
{
if (discuss.CreatorId != _currentUser.Id)
{
throw new UserFriendlyException(DiscussConst.);
}
}
if (discuss.PermissionType == DiscussPermissionTypeEnum.User)
{
if (discuss.CreatorId != _currentUser.Id && !discuss.PermissionUserIds.Contains(_currentUser.Id))
{
throw new UserFriendlyException(DiscussConst.);
}
}
}
}
}

View File

@@ -0,0 +1,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
{
/// <summary>
/// Label服务实现
/// </summary>
[AppService]
public class MyTypeService : CrudAppService<MyTypeEntity, MyTypeOutputDto, MyTypeGetListOutputDto, long, MyTypeGetListInputVo, MyTypeCreateInputVo, MyTypeUpdateInputVo>,
ILabelService, IAutoApiService
{
[Autowired]
private ICurrentUser _currentUser { get; set; }
[Autowired]
private IDataFilter _dataFilter { get; set; }
/// <summary>
/// 获取当前用户的主题类型
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public Task<PagedResultDto<MyTypeGetListOutputDto>> GetListCurrentAsync(MyTypeGetListInputVo input)
{
_dataFilter.AddFilter<MyTypeEntity>(x => x.UserId == _currentUser.Id);
return base.GetListAsync(input);
}
/// <summary>
/// 创建
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public override async Task<MyTypeOutputDto> CreateAsync(MyTypeCreateInputVo input)
{
var entity = await MapToEntityAsync(input);
entity.Id = SnowflakeHelper.NextId;
entity.UserId = _currentUser.Id;
entity.IsDeleted = false;
var outputEntity = await _repository.InsertReturnEntityAsync(entity);
return await MapToGetOutputDtoAsync(outputEntity);
}
}
}

View File

@@ -0,0 +1,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
{
/// <summary>
/// Plate服务实现
/// </summary>
[AppService]
public class PlateService : CrudAppService<PlateEntity, PlateGetOutputDto, PlateGetListOutputDto, long, PlateGetListInputVo, PlateCreateInputVo, PlateUpdateInputVo>,
IPlateService, IAutoApiService
{
}
}

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