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

85 rivejä
2.0 KiB

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