//
namespace SafeCampus.Web.Core;
///
/// 系统通用控制器,一般是一些公共的接口
///
[Route("sys")]
public class CommonController : BaseController
{
private readonly ISysOrgService _sysOrgService;
private readonly IConfigService _configService;
public CommonController(IConfigService configService, ISysOrgService sysOrgService)
{
_sysOrgService = sysOrgService;
_configService = configService;
}
///
/// 获取系统基础配置
///
///
[HttpGet("ico")]
[AllowAnonymous]
[NonUnify]
public async Task Ico()
{
return await _configService.GetIco();
}
///
/// 获取系统基础配置
///
///
[HttpGet("sysInfo")]
[AllowAnonymous]
public async Task SysInfo()
{
var sysBase = await _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_BASE);
//排除掉一些不需要的配置
var configKeys = new List()
{
SysConfigConst.SYS_ICO,
SysConfigConst.SYS_WEB_STATUS,
SysConfigConst.SYS_WEB_CLOSE_PROMPT,
SysConfigConst.SYS_DEFAULT_WORKBENCH_DATA
};
sysBase = sysBase.Where(x => !configKeys.Contains(x.ConfigKey)).ToList();
return sysBase;
}
///
/// 获取系统基础配置
///
///
[HttpGet("loginPolicy")]
[AllowAnonymous]
public async Task LoginPolicy()
{
var loginPolicy = await _configService.GetConfigsByCategory(CateGoryConst.CONFIG_LOGIN_POLICY);//登录策略
return loginPolicy;
}
///
/// 获取租户列表
///
///
[HttpGet("tenantList")]
[AllowAnonymous]
public async Task TenantList()
{
return await _sysOrgService.GetTenantList();
}
}