This commit is contained in:
zpc 2025-08-18 16:04:03 +08:00
parent 0d094db7d3
commit eaa5f3f610

View File

@ -25,25 +25,27 @@ namespace ZR.Admin.WebApi.Controllers
private IWebHostEnvironment WebHostEnvironment;
private ISysFileService SysFileService;
private readonly IStringLocalizer<SharedResource> _localizer;
public readonly ISysDeptService _deptService;
/// <summary>
///
/// CommonController 构造函数
/// </summary>
/// <param name="stringLocalizer"></param>
/// <param name="options"></param>
/// <param name="webHostEnvironment"></param>
/// <param name="fileService"></param>
/// <param name="deptService"></param>
public CommonController(
IStringLocalizer<SharedResource> stringLocalizer,
IOptions<OptionsSetting> options,
IWebHostEnvironment webHostEnvironment,
ISysFileService fileService)
ISysFileService fileService,
ISysDeptService deptService)
{
WebHostEnvironment = webHostEnvironment;
SysFileService = fileService;
OptionsSetting = options.Value;
_localizer = stringLocalizer;
_deptService = deptService;
}
/// <summary>
@ -212,7 +214,14 @@ namespace ZR.Admin.WebApi.Controllers
public async Task<IActionResult> GetConfig()
{
var file = await SysFileService.AsQueryable().Where(x => x.ClassifyType == "watermark").FirstAsync();
return SUCCESS(new { logo = file?.AccessUrl ?? "" });
var topDept = await _deptService.AsQueryable().Where(it => it.ParentId == 0 && it.DelFlag == 0 && it.Status == 0).FirstAsync();
List<string> deptList = new List<string>();
if (topDept != null)
{
var children = await _deptService.AsQueryable().Where(it => it.ParentId == topDept.DeptId && it.DelFlag == 0 && it.Status == 0).Select(it => it.DeptName).ToListAsync();
deptList = children;
}
return SUCCESS(new { logo = file?.AccessUrl ?? "", deptList });
}
}