LingAdmin/Backend/Services/AuthorizationService/LingAdmin.AuthorizationService/Controllers/HealthController.cs

60 lines
1.2 KiB
C#
Raw Normal View History

2026-04-16 18:13:06 +08:00
using Microsoft.AspNetCore.Mvc;
namespace LingAdmin.AuthorizationService.Controllers;
/// <summary>
/// 健康检查控制器
/// </summary>
[ApiController]
[Route("api/[controller]")]
public class HealthController : ControllerBase
{
private readonly ILogger<HealthController> _logger;
public HealthController(ILogger<HealthController> logger)
{
_logger = logger;
}
/// <summary>
/// 健康检查
/// </summary>
[HttpGet]
public ActionResult<object> GetHealth()
{
return Ok(new
{
Status = "Healthy",
Service = "Authorization Service",
Timestamp = DateTime.UtcNow,
Version = "1.0.0"
});
}
/// <summary>
/// 就绪检查
/// </summary>
[HttpGet("ready")]
public ActionResult<object> GetReadiness()
{
return Ok(new
{
Status = "Ready",
Timestamp = DateTime.UtcNow
});
}
/// <summary>
/// 存活检查
/// </summary>
[HttpGet("live")]
public ActionResult<object> GetLiveness()
{
return Ok(new
{
Status = "Alive",
Timestamp = DateTime.UtcNow
});
}
}