Add files via upload

This commit is contained in:
weiaiweiai
2025-09-21 16:38:23 +08:00
committed by GitHub
commit a60afec5a8
11 changed files with 847 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using WebApplication4.Services;
namespace WebApplication4.Controllers
{
[ApiController]
[Route("[controller]")]
public class WeatherForecastController : ControllerBase
{
private readonly ILogger<WeatherForecastController> _logger;
private readonly WebSocketMessageStore _wsStore;
public WeatherForecastController(
ILogger<WeatherForecastController> logger,
WebSocketMessageStore wsStore)
{
_logger = logger;
_wsStore = wsStore;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB> WebSocket <20><>Ϣ
[HttpGet("lastws")]
public IActionResult GetLastWebSocketMessage()
{
var (message, ts) = _wsStore.Get();
if (message == null)
{
return NotFound(new
{
success = false,
message = "<22><>δ<EFBFBD>յ<EFBFBD><D5B5>κ<EFBFBD> WebSocket <20><>Ϣ<EFBFBD><CFA2>"
});
}
return Ok(message);
}
}
}