28 lines
697 B
C#
28 lines
697 B
C#
using Application;
|
|
|
|
namespace WebApi.Controllers;
|
|
|
|
[ApiController]
|
|
[Route("api/[controller]/[action]")]
|
|
public class ConfigController(
|
|
IConfigApplication configApplication
|
|
) : ControllerBase
|
|
{
|
|
/// <summary>
|
|
/// 获取配置值
|
|
/// </summary>
|
|
public async Task<BaseResponse<string>> GetConfig(string key)
|
|
{
|
|
var value = await configApplication.GetConfigAsync(key);
|
|
return value.Ok("配置获取成功");
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置配置值
|
|
/// </summary>
|
|
public async Task<BaseResponse> SetConfig(string key, string value)
|
|
{
|
|
await configApplication.SetConfigAsync(key, value);
|
|
return "配置设置成功".Ok();
|
|
}
|
|
} |