Files
EmailBill/WebApi/Controllers/ConfigController.cs
SunCheng d052ae5197 fix
2026-02-10 17:49:19 +08:00

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