using CoreAgent.Application.Commands.CellularNetwork; using CoreAgent.Domain.Models.Common; using CoreAgent.Domain.Models.Network; using MediatR; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; namespace CoreAgent.API.Controllers; /// /// 蜂窝网络控制器 /// [ApiVersion("1.0")] public class CellularNetworkController : BaseApiController { private readonly ILogger _logger; public CellularNetworkController( IMediator mediator, ILogger logger) : base(mediator, logger) { _logger = logger; } /// /// 启动蜂窝网络 /// /// 启动命令 /// 操作结果 [HttpPost("start")] [ProducesResponseType(typeof(ApiActionResult), 200)] [ProducesResponseType(typeof(ApiActionResult), 400)] [ProducesResponseType(typeof(ApiActionResult), 500)] public async Task Start([FromBody] StartCellularNetworkCommand command) { _logger.LogInformation("收到启动蜂窝网络请求: {ConfigKey}", command.Key); return await HandleRequest>(command); } /// /// 停止蜂窝网络 /// /// 停止命令 /// 操作结果 [HttpPost("stop")] [ProducesResponseType(typeof(ApiActionResult), 200)] [ProducesResponseType(typeof(ApiActionResult), 400)] [ProducesResponseType(typeof(ApiActionResult), 500)] public async Task Stop([FromBody] StopCellularNetworkCommand command) { _logger.LogInformation("收到停止蜂窝网络请求: {InterfaceName}", command.Key); return await HandleRequest>(command); } }