Files
it/backend/HardwarePerformance.API/Controllers/SimpleTestController.cs
2025-11-03 17:03:57 +08:00

57 lines
2.1 KiB
C#

using Microsoft.AspNetCore.Mvc;
namespace HardwarePerformance.API.Controllers;
[ApiController]
[Route("api/[controller]")]
public class SimpleTestController : ControllerBase
{
private readonly ILogger<SimpleTestController> _logger;
public SimpleTestController(ILogger<SimpleTestController> logger)
{
_logger = logger;
}
[HttpGet("status")]
public IActionResult GetStatus()
{
return Ok(new
{
Status = "Running",
Message = "API服务正常运行",
Timestamp = DateTime.Now,
Version = "1.0.0"
});
}
[HttpGet("test-data")]
public IActionResult GetTestData()
{
var categories = new[]
{
new { Id = 1, Name = "手机CPU", Description = "移动设备处理器" },
new { Id = 2, Name = "手机GPU", Description = "移动设备图形处理器" },
new { Id = 3, Name = "电脑CPU", Description = "桌面和笔记本处理器" },
new { Id = 4, Name = "电脑GPU", Description = "桌面和笔记本图形处理器" }
};
var products = new[]
{
new { Id = 1, Name = "Apple A17 Pro", Model = "A17 Pro", Manufacturer = "Apple", CategoryId = 1, CurrentRank = 1 },
new { Id = 2, Name = "Snapdragon 8 Gen 3", Model = "SM8650-AB", Manufacturer = "Qualcomm", CategoryId = 1, CurrentRank = 2 },
new { Id = 3, Name = "Intel Core i9-13900K", Model = "Core i9-13900K", Manufacturer = "Intel", CategoryId = 3, CurrentRank = 1 },
new { Id = 4, Name = "AMD Ryzen 9 7950X", Model = "Ryzen 9 7950X", Manufacturer = "AMD", CategoryId = 3, CurrentRank = 2 },
new { Id = 5, Name = "NVIDIA GeForce RTX 4090", Model = "RTX 4090", Manufacturer = "NVIDIA", CategoryId = 4, CurrentRank = 1 },
new { Id = 6, Name = "AMD Radeon RX 7900 XTX", Model = "RX 7900 XTX", Manufacturer = "AMD", CategoryId = 4, CurrentRank = 2 }
};
return Ok(new
{
Categories = categories,
Products = products,
TotalCategories = categories.Length,
TotalProducts = products.Length
});
}
}