删除文件 Yi.Framework.Net6/src/project/BBS

This commit is contained in:
橙子
2023-04-15 06:46:15 +00:00
committed by Gitee
parent ccd39474c7
commit be550a78f6
30 changed files with 0 additions and 1160 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,16 +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 QueryDiscussTypeEnum
{
New,
Suggest,
Host
}
}

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,51 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off">
<variable name="archiveAboveSize" value="10485760"/>
<variable name="maxArchiveFiles" value="50"/>
<variable name="layout" value="${date:format=HH\:mm\:ss.fff}|${level}|${threadId:format=threadId}|${logger}${newline}>>${message} ${exception:format=tostring}"/>
<variable name="logsRootPath" value="${basedir}/logs/${shortdate}" />
<targets>
<target xsi:type="File"
name="AllFile"
fileName="${logsRootPath}/AllFile/log.log"
layout="${layout}${newline}"
archiveAboveSize="${archiveAboveSize}"
maxArchiveFiles="${maxArchiveFiles}" />
<target xsi:type="ColoredConsole"
name="ColoredConsole"
layout="${layout}${newline}">
<highlight-row condition="level == LogLevel.Info" foregroundColor="White" />
<highlight-row condition="level == LogLevel.Debug" foregroundColor="Green" />
<highlight-row condition="level == LogLevel.Warn" foregroundColor="Yellow" />
<highlight-row condition="level == LogLevel.Error" foregroundColor="Red" />
<highlight-row condition="level == LogLevel.Fatal" foregroundColor="Red" backgroundColor="White" />
</target>
<target xsi:type="File" name="OwnFile"
fileName="${logsRootPath}/OwnFile/log.log"
layout="${layout}|Url: ${aspnet-request-url}|Action: ${aspnet-mvc-action}${newline}"
archiveAboveSize="${archiveAboveSize}"
maxArchiveFiles="${maxArchiveFiles}" />
</targets>
<rules>
<logger name="Quartz.*" maxlevel="Warn" final="true" />
<logger name="Grpc.*" maxlevel="Debug" final="true" />
<logger name="Grpc.*" maxlevel="Trace" final="true" />
<logger name="Microsoft.EntityFrameworkCore.*" maxlevel="Warn" final="true" />
<logger name="Microsoft.AspNetCore.*" maxlevel="Warn" final="true" />
<logger name="Microsoft.AspNetCore.SignalR.*" maxlevel="Warn" final="true" />
<logger name="*" minlevel="Debug" maxlevel="Fatal" writeTo="AllFile,ColoredConsole"/>
<logger name="Microsoft.Hosting.Lifetime" minlevel="Info" writeTo="ColoredConsole,OwnFile" final="true" />
<logger name="Microsoft.*" maxlevel="Info" final="true" />
<logger name="*" minlevel="Trace" writeTo="OwnFile" />
</rules>
</nlog>

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