平安校园
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

110 lines
2.6 KiB

  1. //
  2. namespace SafeCampus.Web.Core;
  3. /// <summary>
  4. /// 系统配置控制器
  5. /// </summary>
  6. [ApiDescriptionSettings(Tag = "系统配置")]
  7. [Route("sys/ops/[controller]")]
  8. [SuperAdmin]
  9. public class ConfigController : BaseController
  10. {
  11. private readonly IConfigService _configService;//系统配置服务
  12. public ConfigController(IConfigService configService)
  13. {
  14. _configService = configService;
  15. }
  16. /// <summary>
  17. /// 获取系统基础配置
  18. /// </summary>
  19. /// <returns></returns>
  20. [HttpGet("sysBaseList")]
  21. public async Task<dynamic> SysBaseList()
  22. {
  23. var sysBase = await _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_BASE);//系统基础
  24. var loginPolicy = await _configService.GetConfigsByCategory(CateGoryConst.CONFIG_LOGIN_POLICY);//登录策略
  25. sysBase.AddRange(loginPolicy);//合并登录策略
  26. return sysBase;
  27. }
  28. /// <summary>
  29. /// 获取系统配置列表
  30. /// </summary>
  31. /// <returns></returns>
  32. [HttpGet("list")]
  33. public async Task<dynamic> List()
  34. {
  35. return await _configService.GetSysConfigList();
  36. }
  37. /// <summary>
  38. /// 配置分页
  39. /// </summary>
  40. /// <param name="input"></param>
  41. /// <returns></returns>
  42. [HttpGet("page")]
  43. public async Task<dynamic> Page([FromQuery] ConfigPageInput input)
  44. {
  45. return await _configService.Page(input);
  46. }
  47. /// <summary>
  48. /// 添加配置
  49. /// </summary>
  50. /// <param name="input"></param>
  51. /// <returns></returns>
  52. [HttpPost("add")]
  53. [DisplayName("添加配置")]
  54. public async Task Add([FromBody] ConfigAddInput input)
  55. {
  56. await _configService.Add(input);
  57. }
  58. /// <summary>
  59. /// 修改配置
  60. /// </summary>
  61. /// <param name="input"></param>
  62. /// <returns></returns>
  63. [HttpPost("edit")]
  64. [DisplayName("修改配置")]
  65. public async Task Edit([FromBody] ConfigEditInput input)
  66. {
  67. await _configService.Edit(input);
  68. }
  69. /// <summary>
  70. /// 删除配置
  71. /// </summary>
  72. /// <param name="input"></param>
  73. /// <returns></returns>
  74. [HttpPost("delete")]
  75. [DisplayName("删除配置")]
  76. public async Task Delete([FromBody] ConfigDeleteInput input)
  77. {
  78. await _configService.Delete(input);
  79. }
  80. /// <summary>
  81. /// 配置批量更新
  82. /// </summary>
  83. /// <returns></returns>
  84. [HttpPost("editBatch")]
  85. [DisplayName("修改配置")]
  86. public async Task EditBatch([FromBody] List<SysConfig> devConfigs)
  87. {
  88. await _configService.EditBatch(devConfigs);
  89. }
  90. }