149 lines
5.4 KiB
C#
149 lines
5.4 KiB
C#
using Microsoft.AspNetCore.Mvc;
|
||
using ZR.LiveForum.Model.Liveforum.Dto;
|
||
using ZR.LiveForum.Model.Liveforum;
|
||
using ZR.Service.Liveforum.ILiveforumService;
|
||
|
||
//创建时间:2025-11-16
|
||
namespace ZR.Admin.WebApi.Controllers.Liveforum
|
||
{
|
||
/// <summary>
|
||
/// 认证申请记录
|
||
/// </summary>
|
||
[Route("liveforum/tusercertifications")]
|
||
public class T_UserCertificationsController : BaseController
|
||
{
|
||
/// <summary>
|
||
/// 认证申请记录接口
|
||
/// </summary>
|
||
private readonly IT_UserCertificationsService _T_UserCertificationsService;
|
||
|
||
public T_UserCertificationsController(IT_UserCertificationsService T_UserCertificationsService)
|
||
{
|
||
_T_UserCertificationsService = T_UserCertificationsService;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 查询认证申请记录列表
|
||
/// </summary>
|
||
/// <param name="parm"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("list")]
|
||
[ActionPermissionFilter(Permission = "tusercertifications:list")]
|
||
public IActionResult QueryT_UserCertifications([FromQuery] T_UserCertificationsQueryDto parm)
|
||
{
|
||
var response = _T_UserCertificationsService.GetList(parm);
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
|
||
/// <summary>
|
||
/// 查询认证申请记录详情
|
||
/// </summary>
|
||
/// <param name="Id"></param>
|
||
/// <returns></returns>
|
||
[HttpGet("{Id}")]
|
||
[ActionPermissionFilter(Permission = "tusercertifications:query")]
|
||
public IActionResult GetT_UserCertifications(long Id)
|
||
{
|
||
var response = _T_UserCertificationsService.GetInfo(Id);
|
||
|
||
var info = response.Adapt<T_UserCertificationsDto>();
|
||
return SUCCESS(info);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 添加认证申请记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost]
|
||
[ActionPermissionFilter(Permission = "tusercertifications:add")]
|
||
[Log(Title = "认证申请记录", BusinessType = BusinessType.INSERT)]
|
||
public IActionResult AddT_UserCertifications([FromBody] T_UserCertificationsDto parm)
|
||
{
|
||
var modal = parm.Adapt<T_UserCertifications>().ToCreate(HttpContext);
|
||
modal.Status = 0;
|
||
var response = _T_UserCertificationsService.AddT_UserCertifications(modal);
|
||
|
||
return SUCCESS(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 更新认证申请记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPut]
|
||
[ActionPermissionFilter(Permission = "tusercertifications:edit")]
|
||
[Log(Title = "认证申请记录", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult UpdateT_UserCertifications([FromBody] T_UserCertificationsDto parm)
|
||
{
|
||
|
||
if (parm.Id == 0)
|
||
{
|
||
throw new CustomException(ResultCode.CUSTOM_ERROR, "请求参数为空");
|
||
}
|
||
var oldal = _T_UserCertificationsService.GetById(parm.Id);
|
||
if (oldal == null)
|
||
{
|
||
throw new CustomException(ResultCode.CUSTOM_ERROR, "数据不存在");
|
||
}
|
||
var modal = parm.Adapt(oldal);
|
||
var response = _T_UserCertificationsService.UpdateT_UserCertifications(modal);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除认证申请记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[HttpPost("delete/{ids}")]
|
||
[ActionPermissionFilter(Permission = "tusercertifications:delete")]
|
||
[Log(Title = "认证申请记录", BusinessType = BusinessType.DELETE)]
|
||
public IActionResult DeleteT_UserCertifications([FromRoute] string ids)
|
||
{
|
||
var idArr = Tools.SplitAndConvert<long>(ids);
|
||
|
||
return ToResponse(_T_UserCertificationsService.Delete(idArr));
|
||
}
|
||
|
||
/// <summary>
|
||
/// 导出认证申请记录
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[Log(Title = "认证申请记录", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)]
|
||
[HttpGet("export")]
|
||
[ActionPermissionFilter(Permission = "tusercertifications:export")]
|
||
public IActionResult Export([FromQuery] T_UserCertificationsQueryDto parm)
|
||
{
|
||
var list = _T_UserCertificationsService.ExportList(parm).Result;
|
||
if (list == null || list.Count <= 0)
|
||
{
|
||
return ToResponse(ResultCode.FAIL, "没有要导出的数据");
|
||
}
|
||
var result = ExportExcelMini(list, "认证申请记录", "认证申请记录");
|
||
return ExportExcel(result.Item2, result.Item1);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 审核认证申请
|
||
/// </summary>
|
||
/// <param name="parm">审核参数</param>
|
||
/// <returns></returns>
|
||
[HttpPost("review")]
|
||
[ActionPermissionFilter(Permission = "tusercertifications:review")]
|
||
[Log(Title = "认证审核", BusinessType = BusinessType.UPDATE)]
|
||
public IActionResult ReviewCertification([FromBody] ReviewCertificationDto parm)
|
||
{
|
||
if (parm.Id == 0)
|
||
{
|
||
throw new CustomException(ResultCode.CUSTOM_ERROR, "请求参数为空");
|
||
}
|
||
|
||
long reviewerId = HttpContext.GetUId();
|
||
var response = _T_UserCertificationsService.ReviewCertification(parm, reviewerId);
|
||
|
||
return ToResponse(response);
|
||
}
|
||
|
||
}
|
||
} |