feat: 新增配置管理

This commit is contained in:
chenchun
2024-06-27 18:37:49 +08:00
parent 389ce08dad
commit fcea4c63a7
24 changed files with 132 additions and 48 deletions

View File

@@ -2,11 +2,13 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.RateLimiting;
using Volo.Abp.Application.Services;
using Volo.Abp.Settings;
using Volo.Abp.Uow;
using Yi.Framework.Bbs.Application.Contracts.Dtos.Banner;
using Yi.Framework.Bbs.Domain.Entities.Forum;
using Yi.Framework.Rbac.Domain.Authorization;
using Yi.Framework.Rbac.Domain.Extensions;
using Yi.Framework.SettingManagement.Domain;
using Yi.Framework.SqlSugarCore.Abstractions;
namespace Yi.Abp.Application.Services
@@ -120,7 +122,7 @@ namespace Yi.Abp.Application.Services
var dto = entity.Adapt<BannerGetListOutputDto>();
}
private static int RequestNumber { get; set; } = 0;
/// <summary>
/// 速率限制
/// </summary>
@@ -132,6 +134,27 @@ namespace Yi.Abp.Application.Services
RequestNumber++;
return RequestNumber;
}
private static int RequestNumber { get; set; } = 0;
public ISettingProvider _settingProvider { get; set; }
public ISettingManager _settingManager { get; set; }
/// <summary>
/// 系统配置模块
/// </summary>
/// <returns></returns>
public async Task<string> GetSettingAsync()
{
//默认来说,不提供修改操作,配置应该独立
var enableOrNull = await _settingProvider.GetOrNullAsync("abp.ddd.enable");
//如果要进行修改可使用yi.framework下的ISettingManager
await _settingManager.SetAsync("abp.ddd.enable", "false", "系统", "admin");
var enableOrNull2 = await _settingProvider.GetOrNullAsync("abp.ddd.enable");
return enableOrNull2 ?? string.Empty;
}
}
}

View File

@@ -8,10 +8,11 @@
<ProjectReference Include="..\..\module\chat-hub\Yi.Framework.ChatHub.Application\Yi.Framework.ChatHub.Application.csproj" />
<ProjectReference Include="..\..\module\code-gen\Yi.Framework.CodeGen.Application\Yi.Framework.CodeGen.Application.csproj" />
<ProjectReference Include="..\..\module\rbac\Yi.Framework.Rbac.Application\Yi.Framework.Rbac.Application.csproj" />
<ProjectReference Include="..\..\module\setting-management\Yi.Framework.SettingManagement.Application\Yi.Framework.SettingManagement.Application.csproj" />
<ProjectReference Include="..\..\module\tenant-management\Yi.Framework.TenantManagement.Application\Yi.Framework.TenantManagement.Application.csproj" />
<ProjectReference Include="..\Yi.Abp.Application.Contracts\Yi.Abp.Application.Contracts.csproj" />
<ProjectReference Include="..\Yi.Abp.Domain\Yi.Abp.Domain.csproj" />
</ItemGroup>
</Project>

View File

@@ -1,10 +1,12 @@
using Yi.Abp.Application.Contracts;
using Volo.Abp.SettingManagement;
using Yi.Abp.Application.Contracts;
using Yi.Abp.Domain;
using Yi.Framework.Bbs.Application;
using Yi.Framework.ChatHub.Application;
using Yi.Framework.CodeGen.Application;
using Yi.Framework.Ddd.Application;
using Yi.Framework.Rbac.Application;
using Yi.Framework.SettingManagement.Application;
using Yi.Framework.TenantManagement.Application;
namespace Yi.Abp.Application
@@ -19,6 +21,7 @@ namespace Yi.Abp.Application
typeof(YiFrameworkChatHubApplicationModule),
typeof(YiFrameworkTenantManagementApplicationModule),
typeof(YiFrameworkCodeGenApplicationModule),
typeof (YiFrameworkSettingManagementApplicationModule),
typeof(YiFrameworkDddApplicationModule)
)]