mirror of
https://github.com/weiaiweiai/NezhaAgentHTTPBridge.git
synced 2026-05-13 21:49:09 +08:00
Add files via upload
This commit is contained in:
43
WebApplication4/Controllers/WeatherForecastController.cs
Normal file
43
WebApplication4/Controllers/WeatherForecastController.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user