AdoS8ConfigMonitorDictionaryController.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. using Admin.NET.Plugin.AiDOP.Infrastructure.S8;
  2. using Admin.NET.Plugin.AiDOP.Const.S8;
  3. using Admin.NET.Plugin.AiDOP.Dto.S8;
  4. using Admin.NET.Plugin.AiDOP.Infrastructure;
  5. using Admin.NET.Plugin.AiDOP.Service.S8;
  6. namespace Admin.NET.Plugin.AiDOP.Controllers.S8;
  7. [ApiController]
  8. [Route("api/aidop/s8/config/monitor-options")]
  9. [NonUnify]
  10. public class AdoS8ConfigMonitorDictionaryController : ControllerBase
  11. {
  12. private readonly S8MonitorDictionaryService _svc;
  13. private readonly S8TrustedScopeResolver _scope;
  14. public AdoS8ConfigMonitorDictionaryController(S8MonitorDictionaryService svc, S8TrustedScopeResolver scope)
  15. {
  16. _svc = svc;
  17. _scope = scope;
  18. }
  19. /// <summary>
  20. /// 监控对象/指标只读字典。返回结构与前端 BUSINESS_MONITOR_OPTIONS 同形。
  21. /// CONFIG-MONITOR-DICT-READONLY-SEED-1。
  22. /// </summary>
  23. [HttpGet]
  24. [S8Permission(S8PermissionCatalog.ConfigRead)]
  25. public async Task<IActionResult> GetOptionsAsync(
  26. [FromQuery] long tenantId = 1,
  27. [FromQuery] long factoryId = 1)
  28. {
  29. // Compatibility-only. Security scope is resolved server-side.
  30. _ = tenantId; _ = factoryId;
  31. var scope = await _scope.ResolveAsync();
  32. return Ok(await _svc.GetOptionsAsync(scope.TenantId, scope.FactoryId));
  33. }
  34. }