using Microsoft.AspNetCore.Mvc; using MiGu.Server.Launcher; namespace MiGu.Server.Controllers; [ApiController] [Route("api/health")] public class HealthController : ControllerBase { private static readonly DateTimeOffset StartTime = DateTimeOffset.UtcNow; private readonly SimpleLiteLauncher _launcher; public HealthController(SimpleLiteLauncher launcher) => _launcher = launcher; [HttpGet] public IActionResult Get() { return Ok(new { status = "ok", mode = "WebEnabled", startTime = StartTime, uptimeSec = (long)(DateTimeOffset.UtcNow - StartTime).TotalSeconds, ports = new { webApi = 7001, webSocket = 7002, platform = 8080, vrender = 8223, vehicle = 8222 }, architecture = "v1.5" }); } /// /// SimpleLite 拉起配置诊断:查看当前 ExecutablePath、解析结果、端口是否已有服务。 /// 配置位置:MiGu.Server/appsettings.jsonSimpleLite 节点。 /// [HttpGet("simplelite")] public IActionResult GetSimpleLiteDiagnostics() => Ok(_launcher.GetDiagnostics()); }