//
namespace SafeCampus.Web.Core;
///
/// 系统配置控制器
///
[ApiDescriptionSettings(Tag = "系统配置")]
[Route("sys/ops/[controller]")]
[SuperAdmin]
public class ConfigController : BaseController
{
private readonly IConfigService _configService;//系统配置服务
public ConfigController(IConfigService configService)
{
_configService = configService;
}
///
/// 获取系统基础配置
///
///
[HttpGet("sysBaseList")]
public async Task SysBaseList()
{
var sysBase = await _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_BASE);//系统基础
var loginPolicy = await _configService.GetConfigsByCategory(CateGoryConst.CONFIG_LOGIN_POLICY);//登录策略
sysBase.AddRange(loginPolicy);//合并登录策略
return sysBase;
}
///
/// 获取系统配置列表
///
///
[HttpGet("list")]
public async Task List()
{
return await _configService.GetSysConfigList();
}
///
/// 配置分页
///
///
///
[HttpGet("page")]
public async Task Page([FromQuery] ConfigPageInput input)
{
return await _configService.Page(input);
}
///
/// 添加配置
///
///
///
[HttpPost("add")]
[DisplayName("添加配置")]
public async Task Add([FromBody] ConfigAddInput input)
{
await _configService.Add(input);
}
///
/// 修改配置
///
///
///
[HttpPost("edit")]
[DisplayName("修改配置")]
public async Task Edit([FromBody] ConfigEditInput input)
{
await _configService.Edit(input);
}
///
/// 删除配置
///
///
///
[HttpPost("delete")]
[DisplayName("删除配置")]
public async Task Delete([FromBody] ConfigDeleteInput input)
{
await _configService.Delete(input);
}
///
/// 配置批量更新
///
///
[HttpPost("editBatch")]
[DisplayName("修改配置")]
public async Task EditBatch([FromBody] List devConfigs)
{
await _configService.EditBatch(devConfigs);
}
}