4 changed files with 354 additions and 0 deletions
@ -0,0 +1,92 @@ |
|||
# LINGYUN.Abp.SettingManagement.Application |
|||
|
|||
## Module Description |
|||
|
|||
Setting management application service module, implementing business logic for setting management. |
|||
|
|||
### Base Modules |
|||
|
|||
* LINGYUN.Abp.SettingManagement.Application.Contracts |
|||
* Volo.Abp.SettingManagement.Application |
|||
* Volo.Abp.Ddd.Application |
|||
|
|||
### Features |
|||
|
|||
* Provides implementation of setting management application services |
|||
* SettingAppService - General setting management service implementation |
|||
* UserSettingAppService - User setting management service implementation |
|||
* SettingDefinitionAppService - Setting definition management service implementation |
|||
* Implements the following application service interfaces |
|||
* ISettingAppService |
|||
* IUserSettingAppService |
|||
* ISettingDefinitionAppService |
|||
* Provides setting cache management |
|||
* DynamicSettingDefinitionStoreCacheInvalidator - Dynamic setting definition cache invalidation handler |
|||
|
|||
### Application Services |
|||
|
|||
* SettingAppService |
|||
* GetAllForGlobalAsync - Get global settings |
|||
* GetAllForTenantAsync - Get tenant settings |
|||
* GetAllForUserAsync - Get user settings |
|||
* GetAllGroupsAsync - Get all setting groups |
|||
* UpdateAsync - Update settings |
|||
* UserSettingAppService |
|||
* GetAsync - Get user settings |
|||
* UpdateAsync - Update user settings |
|||
* DeleteAsync - Delete user settings |
|||
* SettingDefinitionAppService |
|||
* GetAsync - Get setting definition |
|||
* GetListAsync - Get setting definition list |
|||
* CreateAsync - Create setting definition |
|||
* UpdateAsync - Update setting definition |
|||
* DeleteAsync - Delete setting definition |
|||
|
|||
### Error Codes |
|||
|
|||
* SettingManagement:010001 - Setting definition name already exists |
|||
* SettingManagement:010002 - Setting definition does not exist |
|||
* SettingManagement:010003 - Setting definition is static, modification not allowed |
|||
* SettingManagement:010004 - Setting definition is static, deletion not allowed |
|||
|
|||
### How to Use |
|||
|
|||
1. Add `AbpSettingManagementApplicationModule` dependency |
|||
|
|||
```csharp |
|||
[DependsOn(typeof(AbpSettingManagementApplicationModule))] |
|||
public class YouProjectModule : AbpModule |
|||
{ |
|||
} |
|||
``` |
|||
|
|||
2. Inject and use setting services |
|||
|
|||
```csharp |
|||
public class YourService |
|||
{ |
|||
private readonly ISettingAppService _settingAppService; |
|||
private readonly IUserSettingAppService _userSettingAppService; |
|||
|
|||
public YourService( |
|||
ISettingAppService settingAppService, |
|||
IUserSettingAppService userSettingAppService) |
|||
{ |
|||
_settingAppService = settingAppService; |
|||
_userSettingAppService = userSettingAppService; |
|||
} |
|||
|
|||
public async Task ManageSettingsAsync() |
|||
{ |
|||
// Get global settings |
|||
var settings = await _settingAppService.GetAllForGlobalAsync(); |
|||
|
|||
// Update user settings |
|||
await _userSettingAppService.UpdateAsync( |
|||
"SettingName", |
|||
"NewValue"); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
[查看中文](README.md) |
|||
@ -0,0 +1,92 @@ |
|||
# LINGYUN.Abp.SettingManagement.Application |
|||
|
|||
## 模块说明 |
|||
|
|||
设置管理应用服务模块,实现设置管理相关的业务逻辑。 |
|||
|
|||
### 基础模块 |
|||
|
|||
* LINGYUN.Abp.SettingManagement.Application.Contracts |
|||
* Volo.Abp.SettingManagement.Application |
|||
* Volo.Abp.Ddd.Application |
|||
|
|||
### 功能定义 |
|||
|
|||
* 提供设置管理的应用服务实现 |
|||
* SettingAppService - 通用设置管理服务实现 |
|||
* UserSettingAppService - 用户设置管理服务实现 |
|||
* SettingDefinitionAppService - 设置定义管理服务实现 |
|||
* 实现以下应用服务接口 |
|||
* ISettingAppService |
|||
* IUserSettingAppService |
|||
* ISettingDefinitionAppService |
|||
* 提供设置缓存管理 |
|||
* DynamicSettingDefinitionStoreCacheInvalidator - 动态设置定义缓存失效处理 |
|||
|
|||
### 应用服务 |
|||
|
|||
* SettingAppService |
|||
* GetAllForGlobalAsync - 获取全局设置 |
|||
* GetAllForTenantAsync - 获取租户设置 |
|||
* GetAllForUserAsync - 获取用户设置 |
|||
* GetAllGroupsAsync - 获取所有设置组 |
|||
* UpdateAsync - 更新设置 |
|||
* UserSettingAppService |
|||
* GetAsync - 获取用户设置 |
|||
* UpdateAsync - 更新用户设置 |
|||
* DeleteAsync - 删除用户设置 |
|||
* SettingDefinitionAppService |
|||
* GetAsync - 获取设置定义 |
|||
* GetListAsync - 获取设置定义列表 |
|||
* CreateAsync - 创建设置定义 |
|||
* UpdateAsync - 更新设置定义 |
|||
* DeleteAsync - 删除设置定义 |
|||
|
|||
### 错误代码 |
|||
|
|||
* SettingManagement:010001 - 设置定义名称已存在 |
|||
* SettingManagement:010002 - 设置定义不存在 |
|||
* SettingManagement:010003 - 设置定义为静态,不允许修改 |
|||
* SettingManagement:010004 - 设置定义为静态,不允许删除 |
|||
|
|||
### 如何使用 |
|||
|
|||
1. 添加 `AbpSettingManagementApplicationModule` 依赖 |
|||
|
|||
```csharp |
|||
[DependsOn(typeof(AbpSettingManagementApplicationModule))] |
|||
public class YouProjectModule : AbpModule |
|||
{ |
|||
} |
|||
``` |
|||
|
|||
2. 注入并使用设置服务 |
|||
|
|||
```csharp |
|||
public class YourService |
|||
{ |
|||
private readonly ISettingAppService _settingAppService; |
|||
private readonly IUserSettingAppService _userSettingAppService; |
|||
|
|||
public YourService( |
|||
ISettingAppService settingAppService, |
|||
IUserSettingAppService userSettingAppService) |
|||
{ |
|||
_settingAppService = settingAppService; |
|||
_userSettingAppService = userSettingAppService; |
|||
} |
|||
|
|||
public async Task ManageSettingsAsync() |
|||
{ |
|||
// 获取全局设置 |
|||
var settings = await _settingAppService.GetAllForGlobalAsync(); |
|||
|
|||
// 更新用户设置 |
|||
await _userSettingAppService.UpdateAsync( |
|||
"SettingName", |
|||
"NewValue"); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
[查看英文](README.EN.md) |
|||
@ -0,0 +1,85 @@ |
|||
# LINGYUN.Abp.SettingManagement.HttpApi |
|||
|
|||
## Module Description |
|||
|
|||
Setting management HTTP API module, providing RESTful API interfaces for setting management. |
|||
|
|||
### Base Modules |
|||
|
|||
* LINGYUN.Abp.SettingManagement.Application.Contracts |
|||
* Volo.Abp.AspNetCore.Mvc |
|||
|
|||
### Features |
|||
|
|||
* Provides API controllers for setting management |
|||
* SettingController - General setting management controller |
|||
* UserSettingController - User setting management controller |
|||
* SettingDefinitionController - Setting definition management controller |
|||
|
|||
### API Endpoints |
|||
|
|||
* /api/setting-management/settings |
|||
* GET /by-global - Get global settings |
|||
* GET /by-tenant - Get tenant settings |
|||
* GET /by-user - Get user settings |
|||
* GET /groups - Get all setting groups |
|||
* PUT /{providerName}/{providerKey} - Update settings |
|||
* /api/setting-management/users |
|||
* GET - Get user settings |
|||
* PUT - Update user settings |
|||
* DELETE - Delete user settings |
|||
* /api/setting-management/definitions |
|||
* GET - Get setting definition list |
|||
* POST - Create setting definition |
|||
* PUT - Update setting definition |
|||
* DELETE - Delete setting definition |
|||
* GET /{name} - Get specific setting definition |
|||
|
|||
### Permission Requirements |
|||
|
|||
* SettingManagement.Settings |
|||
* Update - Update settings |
|||
* ManageGroup - Manage setting groups |
|||
* SettingManagement.ManageFeatures |
|||
* ManageHostFeatures - Manage host features |
|||
|
|||
### How to Use |
|||
|
|||
1. Add `AbpSettingManagementHttpApiModule` dependency |
|||
|
|||
```csharp |
|||
[DependsOn(typeof(AbpSettingManagementHttpApiModule))] |
|||
public class YouProjectModule : AbpModule |
|||
{ |
|||
} |
|||
``` |
|||
|
|||
2. Use API endpoints |
|||
|
|||
```csharp |
|||
public class YourService |
|||
{ |
|||
private readonly HttpClient _httpClient; |
|||
|
|||
public YourService(HttpClient httpClient) |
|||
{ |
|||
_httpClient = httpClient; |
|||
} |
|||
|
|||
public async Task ManageSettingsAsync() |
|||
{ |
|||
// Get global settings |
|||
var response = await _httpClient.GetAsync("/api/setting-management/settings/by-global"); |
|||
var settings = await response.Content.ReadFromJsonAsync<ListResultDto<SettingGroupDto>>(); |
|||
|
|||
// Update user settings |
|||
await _httpClient.PutAsJsonAsync("/api/setting-management/users", new UpdateSettingDto |
|||
{ |
|||
Name = "SettingName", |
|||
Value = "NewValue" |
|||
}); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
[查看中文](README.md) |
|||
@ -0,0 +1,85 @@ |
|||
# LINGYUN.Abp.SettingManagement.HttpApi |
|||
|
|||
## 模块说明 |
|||
|
|||
设置管理 HTTP API 模块,提供设置管理的 RESTful API 接口。 |
|||
|
|||
### 基础模块 |
|||
|
|||
* LINGYUN.Abp.SettingManagement.Application.Contracts |
|||
* Volo.Abp.AspNetCore.Mvc |
|||
|
|||
### 功能定义 |
|||
|
|||
* 提供设置管理的 API 控制器 |
|||
* SettingController - 通用设置管理控制器 |
|||
* UserSettingController - 用户设置管理控制器 |
|||
* SettingDefinitionController - 设置定义管理控制器 |
|||
|
|||
### API 接口 |
|||
|
|||
* /api/setting-management/settings |
|||
* GET /by-global - 获取全局设置 |
|||
* GET /by-tenant - 获取租户设置 |
|||
* GET /by-user - 获取用户设置 |
|||
* GET /groups - 获取所有设置组 |
|||
* PUT /{providerName}/{providerKey} - 更新设置 |
|||
* /api/setting-management/users |
|||
* GET - 获取用户设置 |
|||
* PUT - 更新用户设置 |
|||
* DELETE - 删除用户设置 |
|||
* /api/setting-management/definitions |
|||
* GET - 获取设置定义列表 |
|||
* POST - 创建设置定义 |
|||
* PUT - 更新设置定义 |
|||
* DELETE - 删除设置定义 |
|||
* GET /{name} - 获取指定设置定义 |
|||
|
|||
### 权限要求 |
|||
|
|||
* SettingManagement.Settings |
|||
* Update - 更新设置 |
|||
* ManageGroup - 管理设置组 |
|||
* SettingManagement.ManageFeatures |
|||
* ManageHostFeatures - 管理主机功能 |
|||
|
|||
### 如何使用 |
|||
|
|||
1. 添加 `AbpSettingManagementHttpApiModule` 依赖 |
|||
|
|||
```csharp |
|||
[DependsOn(typeof(AbpSettingManagementHttpApiModule))] |
|||
public class YouProjectModule : AbpModule |
|||
{ |
|||
} |
|||
``` |
|||
|
|||
2. 使用 API 接口 |
|||
|
|||
```csharp |
|||
public class YourService |
|||
{ |
|||
private readonly HttpClient _httpClient; |
|||
|
|||
public YourService(HttpClient httpClient) |
|||
{ |
|||
_httpClient = httpClient; |
|||
} |
|||
|
|||
public async Task ManageSettingsAsync() |
|||
{ |
|||
// 获取全局设置 |
|||
var response = await _httpClient.GetAsync("/api/setting-management/settings/by-global"); |
|||
var settings = await response.Content.ReadFromJsonAsync<ListResultDto<SettingGroupDto>>(); |
|||
|
|||
// 更新用户设置 |
|||
await _httpClient.PutAsJsonAsync("/api/setting-management/users", new UpdateSettingDto |
|||
{ |
|||
Name = "SettingName", |
|||
Value = "NewValue" |
|||
}); |
|||
} |
|||
} |
|||
``` |
|||
|
|||
[查看英文](README.EN.md) |
|||
Loading…
Reference in new issue