Files
NapCatRobot/NapCatRobotClient/NapCatRobotClient.API/Controllers/EntryController.cs
T
2026-07-25 19:37:53 +08:00

33 lines
970 B
C#

using Furion.Logging;
using Microsoft.AspNetCore.Mvc;
using NapCatRobotClient.Service.Dispatcher.Service;
namespace NapCatRobotClient.API.Controllers
{
[ApiController]
[Route("api/[controller]")]
public class EntryController : ControllerBase
{
private readonly IDispatcherService _dispatcherService;
public EntryController(IDispatcherService dispatcherService)
{
_dispatcherService = dispatcherService;
}
/// <summary>
/// 接收消息入口
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<IActionResult> Post()
{
using StreamReader reader = new(Request.Body);
string body = await reader.ReadToEndAsync();
//Log.Information($"接收到群消息:{body} \r\n");
bool result = await _dispatcherService.ReceiveMessageAndProcess(body);
return Ok(result);
}
}
}