using Microsoft.AspNetCore.Mvc; namespace DramaLing.API.Controllers; [ApiController] [Route("api/[controller]")] public class HealthController : ControllerBase { /// /// 健康檢查端點 /// /// 服務健康狀態 [HttpGet] public IActionResult GetHealth() { var response = new { Status = "Healthy", Timestamp = DateTime.UtcNow, Version = "1.0.0", Service = "Drama Ling API" }; return Ok(response); } /// /// 詳細健康檢查 /// /// 詳細的系統狀態 [HttpGet("detailed")] public IActionResult GetDetailedHealth() { var response = new { Status = "Healthy", Timestamp = DateTime.UtcNow, Version = "1.0.0", Service = "Drama Ling API", Environment = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production", Uptime = Environment.TickCount64, Database = "Connected", // TODO: 實際檢查資料庫連線 Cache = "Connected", // TODO: 實際檢查Redis連線 Memory = new { WorkingSet = GC.GetTotalMemory(false), GcCollections = new { Gen0 = GC.CollectionCount(0), Gen1 = GC.CollectionCount(1), Gen2 = GC.CollectionCount(2) } } }; return Ok(response); } }