This commit is contained in:
zpc 2025-11-16 11:23:52 +08:00
parent 02168e0c24
commit e72aad5cb8

View File

@ -1,6 +1,10 @@
using Mapster;
using Microsoft.AspNetCore.Mvc;
using ZR.LiveForum.Model.Liveforum.Dto;
using ZR.LiveForum.Model.Liveforum;
using ZR.LiveForum.Model.Liveforum.Dto;
using ZR.Service.Liveforum;
using ZR.Service.Liveforum.ILiveforumService;
//创建时间2025-11-15
@ -46,7 +50,6 @@ namespace ZR.Admin.WebApi.Controllers.Liveforum
public IActionResult GetT_UserLevels(int Id)
{
var response = _T_UserLevelsService.GetInfo(Id);
var info = response.Adapt<T_UserLevelsDto>();
return SUCCESS(info);
}
@ -61,7 +64,8 @@ namespace ZR.Admin.WebApi.Controllers.Liveforum
public IActionResult AddT_UserLevels([FromBody] T_UserLevelsDto parm)
{
var modal = parm.Adapt<T_UserLevels>().ToCreate(HttpContext);
modal.CreatedAt = DateTime.Now;
modal.UpdatedAt = DateTime.Now;
var response = _T_UserLevelsService.AddT_UserLevels(modal);
return SUCCESS(response);
@ -76,7 +80,17 @@ namespace ZR.Admin.WebApi.Controllers.Liveforum
[Log(Title = "等级配置", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateT_UserLevels([FromBody] T_UserLevelsDto parm)
{
var modal = parm.Adapt<T_UserLevels>().ToUpdate(HttpContext);
if (parm.Id == 0)
{
throw new CustomException(ResultCode.CUSTOM_ERROR, "请求参数为空");
}
var oldal = _T_UserLevelsService.GetById(parm.Id);
if (oldal == null)
{
throw new CustomException(ResultCode.CUSTOM_ERROR, "数据不存在");
}
var modal = parm.Adapt(oldal);
modal.UpdatedAt = DateTime.Now;
var response = _T_UserLevelsService.UpdateT_UserLevels(modal);
return ToResponse(response);