111 lines
3.7 KiB
C#
111 lines
3.7 KiB
C#
using DRS9.Dashboard.Application.DTOs;
|
|
using DRS9.Dashboard.Application.Services;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace DRS9.Dashboard.Server.Controllers;
|
|
|
|
// 播放列表功能已禁用
|
|
// [ApiController]
|
|
// [Route("api/admin/[controller]")]
|
|
// // [Authorize] - 暂时禁用认证以便测试
|
|
// public class PlaylistsController : ControllerBase
|
|
// {
|
|
// private readonly PlaylistService _playlistService;
|
|
// private readonly ILogger<PlaylistsController> _logger;
|
|
//
|
|
// public PlaylistsController(PlaylistService playlistService, ILogger<PlaylistsController> logger)
|
|
// {
|
|
// _playlistService = playlistService;
|
|
// _logger = logger;
|
|
// }
|
|
//
|
|
// /// <summary>
|
|
// /// 获取所有播放列表
|
|
// /// </summary>
|
|
// [HttpGet]
|
|
// public async Task<ActionResult<PlaylistListResponse>> GetAll()
|
|
// {
|
|
// var result = await _playlistService.GetAllAsync();
|
|
// return Ok(result);
|
|
// }
|
|
//
|
|
// /// <summary>
|
|
// /// 获取播放列表详情
|
|
// /// </summary>
|
|
// [HttpGet("{id}")]
|
|
// public async Task<ActionResult<PlaylistDetailDto>> GetById(int id)
|
|
// {
|
|
// var result = await _playlistService.GetByIdAsync(id);
|
|
// if (result == null)
|
|
// {
|
|
// return NotFound(new { success = false, message = "播放列表不存在" });
|
|
// }
|
|
// return Ok(new { success = true, data = result });
|
|
// }
|
|
//
|
|
// /// <summary>
|
|
// /// 创建播放列表
|
|
// /// </summary>
|
|
// [HttpPost]
|
|
// public async Task<ActionResult<object>> Create([FromBody] PlaylistCreateRequest request)
|
|
// {
|
|
// var result = await _playlistService.CreateAsync(request);
|
|
// if (result == null)
|
|
// {
|
|
// return BadRequest(new { success = false, message = "创建失败" });
|
|
// }
|
|
// _logger.LogInformation("Playlist created: {Name}", request.Name);
|
|
// return Ok(new { success = true, data = result, message = "创建成功" });
|
|
// }
|
|
//
|
|
// /// <summary>
|
|
// /// 更新播放列表
|
|
// /// </summary>
|
|
// [HttpPut("{id}")]
|
|
// public async Task<ActionResult<object>> Update(int id, [FromBody] PlaylistUpdateRequest request)
|
|
// {
|
|
// var result = await _playlistService.UpdateAsync(id, request);
|
|
// if (result == null)
|
|
// {
|
|
// return NotFound(new { success = false, message = "播放列表不存在" });
|
|
// }
|
|
// _logger.LogInformation("Playlist updated: {Id}", id);
|
|
// return Ok(new { success = true, data = result, message = "更新成功" });
|
|
// }
|
|
//
|
|
// /// <summary>
|
|
// /// 删除播放列表
|
|
// /// </summary>
|
|
// [HttpDelete("{id}")]
|
|
// public async Task<ActionResult> Delete(int id)
|
|
// {
|
|
// var success = await _playlistService.DeleteAsync(id);
|
|
// if (!success)
|
|
// {
|
|
// return NotFound(new { success = false, message = "播放列表不存在" });
|
|
// }
|
|
// _logger.LogInformation("Playlist deleted: {Id}", id);
|
|
// return Ok(new { success = true, message = "删除成功" });
|
|
// }
|
|
//
|
|
// /// <summary>
|
|
// /// 将播放列表分配到设备分组
|
|
// /// </summary>
|
|
// [HttpPost("{id}/assign")]
|
|
// public async Task<ActionResult> AssignToGroup(int id, [FromBody] GroupAssignRequest request)
|
|
// {
|
|
// var success = await _playlistService.AssignToGroupAsync(id, request.DeviceGroupId);
|
|
// if (!success)
|
|
// {
|
|
// return NotFound(new { success = false, message = "播放列表不存在" });
|
|
// }
|
|
// return Ok(new { success = true, message = "分配成功" });
|
|
// }
|
|
// }
|
|
//
|
|
// public record GroupAssignRequest
|
|
// {
|
|
// public int? DeviceGroupId { get; set; }
|
|
// }
|