从 Simple-FR 拆出 Platform.Server 并重命名为 MiGu.Server;frontends 源码与构建脚本迁入本仓库。地图监控在 projection/cars 失败或为空时回退 reflection 车辆列表;Simple 仓库已移除旧 Platform.Server。 Co-authored-by: Cursor <cursoragent@cursor.com>
43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
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"
|
|
});
|
|
}
|
|
|
|
/// <summary>
|
|
/// SimpleLite 拉起配置诊断:查看当前 ExecutablePath、解析结果、端口是否已有服务。
|
|
/// 配置位置:<c>MiGu.Server/appsettings.json</c> → <c>SimpleLite</c> 节点。
|
|
/// </summary>
|
|
[HttpGet("simplelite")]
|
|
public IActionResult GetSimpleLiteDiagnostics() => Ok(_launcher.GetDiagnostics());
|
|
}
|