54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
|
using ZhiYi.Core.Application.Dtos.Server;
|
|||
|
|
|||
|
namespace ZhiYi.Core.Api.Controllers
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 服务器管理
|
|||
|
/// </summary>
|
|||
|
[Route("api/server/[action]")]
|
|||
|
[ApiController]
|
|||
|
public class ServerController : ControllerBase
|
|||
|
{
|
|||
|
private readonly IServerAppService _serverAppService;
|
|||
|
public ServerController(IServerAppService serverAppService)
|
|||
|
{
|
|||
|
_serverAppService = serverAppService;
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 创建服务器
|
|||
|
/// </summary>
|
|||
|
/// <param name="input"></param>
|
|||
|
/// <returns></returns>
|
|||
|
[HttpPost]
|
|||
|
public async Task CreateAsync([FromBody] ServerCreationDto input)
|
|||
|
=> await _serverAppService.CreateAsync(input);
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 更新服务器
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
[HttpPost]
|
|||
|
public async Task UpdateAsync(ServerUpdationDto input)
|
|||
|
=> await _serverAppService.UpdateAsync(input);
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 删除服务器
|
|||
|
/// </summary>
|
|||
|
/// <param name="input"></param>
|
|||
|
/// <returns></returns>
|
|||
|
[HttpPost]
|
|||
|
public async Task DeleteAsync([FromBody]ServerDeleteDto input)
|
|||
|
=> await _serverAppService.DeleteAsync(input);
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取服务器列表
|
|||
|
/// </summary>
|
|||
|
/// <param name="groupid">组ID</param>
|
|||
|
/// <returns></returns>
|
|||
|
[HttpGet]
|
|||
|
public async Task<ActionResult<AppResponse<List<ZhiYi_Server>>>> GetListAsync([FromQuery]long groupid)
|
|||
|
=> await _serverAppService.GetListAsync(groupid);
|
|||
|
}
|
|||
|
}
|