110 lines
3.5 KiB
C#
110 lines
3.5 KiB
C#
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
|
||
{
|
||
/// <summary>
|
||
/// 主播排行记录
|
||
/// </summary>
|
||
[Route("liveforum/tstreamers")]
|
||
public class T_StreamersController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 主播排行记录接口
|
||
/// </summary>
|
||
private readonly IT_StreamersService _T_StreamersService;
|
||
|
||
public T_StreamersController(IT_StreamersService T_StreamersService)
|
||
{
|
||
_T_StreamersService = T_StreamersService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询主播排行记录列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "tstreamers:list")]
|
||
public IActionResult QueryT_Streamers([FromQuery] T_StreamersQueryDto parm)
|
||
{
|
||
var response = _T_StreamersService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询主播排行记录详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "tstreamers:query")]
|
||
public IActionResult GetT_Streamers(int Id)
|
||
{
|
||
var response = _T_StreamersService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<T_StreamersDto>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加主播排行记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "tstreamers:add")]
|
||
[Log(Title = "主播排行记录", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddT_Streamers([FromBody] T_StreamersDto parm)
|
||
{
|
||
var modal = parm.Adapt<T_Streamers>().ToCreate(HttpContext);
|
||
|
||
var response = _T_StreamersService.AddT_Streamers(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新主播排行记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[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);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除主播排行记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("delete/{ids}")]
|
||
[ActionPermissionFilter(Permission = "tstreamers:delete")]
|
||
[Log(Title = "主播排行记录", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteT_Streamers([FromRoute]string ids)
|
||
{
|
||
var idArr = Tools.SplitAndConvert<int>(ids);
|
||
|
||
return ToResponse(_T_StreamersService.Delete(idArr));
|
||
}
|
||
|
||
}
|
||
} |