平安校园
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.

CommonController.cs 2.0 KiB

4 months ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. 
  2. //
  3. namespace SafeCampus.Web.Core;
  4. /// <summary>
  5. /// 系统通用控制器,一般是一些公共的接口
  6. /// </summary>
  7. [Route("sys")]
  8. public class CommonController : BaseController
  9. {
  10. private readonly ISysOrgService _sysOrgService;
  11. private readonly IConfigService _configService;
  12. public CommonController(IConfigService configService, ISysOrgService sysOrgService)
  13. {
  14. _sysOrgService = sysOrgService;
  15. _configService = configService;
  16. }
  17. /// <summary>
  18. /// 获取系统基础配置
  19. /// </summary>
  20. /// <returns></returns>
  21. [HttpGet("ico")]
  22. [AllowAnonymous]
  23. [NonUnify]
  24. public async Task<dynamic> Ico()
  25. {
  26. return await _configService.GetIco();
  27. }
  28. /// <summary>
  29. /// 获取系统基础配置
  30. /// </summary>
  31. /// <returns></returns>
  32. [HttpGet("sysInfo")]
  33. [AllowAnonymous]
  34. public async Task<dynamic> SysInfo()
  35. {
  36. var sysBase = await _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_BASE);
  37. //排除掉一些不需要的配置
  38. var configKeys = new List<string>()
  39. {
  40. SysConfigConst.SYS_ICO,
  41. SysConfigConst.SYS_WEB_STATUS,
  42. SysConfigConst.SYS_WEB_CLOSE_PROMPT,
  43. SysConfigConst.SYS_DEFAULT_WORKBENCH_DATA
  44. };
  45. sysBase = sysBase.Where(x => !configKeys.Contains(x.ConfigKey)).ToList();
  46. return sysBase;
  47. }
  48. /// <summary>
  49. /// 获取系统基础配置
  50. /// </summary>
  51. /// <returns></returns>
  52. [HttpGet("loginPolicy")]
  53. [AllowAnonymous]
  54. public async Task<dynamic> LoginPolicy()
  55. {
  56. var loginPolicy = await _configService.GetConfigsByCategory(CateGoryConst.CONFIG_LOGIN_POLICY);//登录策略
  57. return loginPolicy;
  58. }
  59. /// <summary>
  60. /// 获取租户列表
  61. /// </summary>
  62. /// <returns></returns>
  63. [HttpGet("tenantList")]
  64. [AllowAnonymous]
  65. public async Task<dynamic> TenantList()
  66. {
  67. return await _sysOrgService.GetTenantList();
  68. }
  69. }