using Microsoft.AspNetCore.Mvc;
using ZR.LiveForum.Model.Liveforum.Dto;
using ZR.LiveForum.Model.Liveforum;
using ZR.Service.Liveforum.ILiveforumService;
//创建时间:2025-11-22
namespace ZR.Admin.WebApi.Controllers.Liveforum
{
///
/// 主播排行记录
///
[Route("liveforum/tstreamers")]
public class T_StreamersController : BaseController
{
///
/// 主播排行记录接口
///
private readonly IT_StreamersService _T_StreamersService;
public T_StreamersController(IT_StreamersService T_StreamersService)
{
_T_StreamersService = T_StreamersService;
}
///
/// 查询主播排行记录列表
///
///
///
[HttpGet("list")]
[ActionPermissionFilter(Permission = "tstreamers:list")]
public IActionResult QueryT_Streamers([FromQuery] T_StreamersQueryDto parm)
{
var response = _T_StreamersService.GetList(parm);
return SUCCESS(response);
}
///
/// 查询主播排行记录详情
///
///
///
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "tstreamers:query")]
public IActionResult GetT_Streamers(int Id)
{
var response = _T_StreamersService.GetInfo(Id);
var info = response.Adapt();
return SUCCESS(info);
}
///
/// 添加主播排行记录
///
///
[HttpPost]
[ActionPermissionFilter(Permission = "tstreamers:add")]
[Log(Title = "主播排行记录", BusinessType = BusinessType.INSERT)]
public IActionResult AddT_Streamers([FromBody] T_StreamersDto parm)
{
var modal = parm.Adapt().ToCreate(HttpContext);
var response = _T_StreamersService.AddT_Streamers(modal);
return SUCCESS(response);
}
///
/// 更新主播排行记录
///
///
[HttpPut]
[ActionPermissionFilter(Permission = "tstreamers:edit")]
[Log(Title = "主播排行记录", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateT_Streamers([FromBody] T_StreamersDto parm)
{
if (parm.Id == 0)
{
throw new CustomException(ResultCode.CUSTOM_ERROR, "请求参数为空");
}
var oldal = _T_StreamersService.GetById(parm.Id);
if (oldal == null)
{
throw new CustomException(ResultCode.CUSTOM_ERROR, "数据不存在");
}
var modal = parm.Adapt(oldal);
var response = _T_StreamersService.UpdateT_Streamers(modal);
return ToResponse(response);
}
///
/// 删除主播排行记录
///
///
[HttpPost("delete/{ids}")]
[ActionPermissionFilter(Permission = "tstreamers:delete")]
[Log(Title = "主播排行记录", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteT_Streamers([FromRoute]string ids)
{
var idArr = Tools.SplitAndConvert(ids);
return ToResponse(_T_StreamersService.Delete(idArr));
}
}
}