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