基础
This commit is contained in:
parent
02168e0c24
commit
e72aad5cb8
|
|
@ -1,6 +1,10 @@
|
||||||
|
using Mapster;
|
||||||
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using ZR.LiveForum.Model.Liveforum.Dto;
|
|
||||||
using ZR.LiveForum.Model.Liveforum;
|
using ZR.LiveForum.Model.Liveforum;
|
||||||
|
using ZR.LiveForum.Model.Liveforum.Dto;
|
||||||
|
using ZR.Service.Liveforum;
|
||||||
using ZR.Service.Liveforum.ILiveforumService;
|
using ZR.Service.Liveforum.ILiveforumService;
|
||||||
|
|
||||||
//创建时间:2025-11-15
|
//创建时间:2025-11-15
|
||||||
|
|
@ -46,7 +50,6 @@ namespace ZR.Admin.WebApi.Controllers.Liveforum
|
||||||
public IActionResult GetT_UserLevels(int Id)
|
public IActionResult GetT_UserLevels(int Id)
|
||||||
{
|
{
|
||||||
var response = _T_UserLevelsService.GetInfo(Id);
|
var response = _T_UserLevelsService.GetInfo(Id);
|
||||||
|
|
||||||
var info = response.Adapt<T_UserLevelsDto>();
|
var info = response.Adapt<T_UserLevelsDto>();
|
||||||
return SUCCESS(info);
|
return SUCCESS(info);
|
||||||
}
|
}
|
||||||
|
|
@ -61,7 +64,8 @@ namespace ZR.Admin.WebApi.Controllers.Liveforum
|
||||||
public IActionResult AddT_UserLevels([FromBody] T_UserLevelsDto parm)
|
public IActionResult AddT_UserLevels([FromBody] T_UserLevelsDto parm)
|
||||||
{
|
{
|
||||||
var modal = parm.Adapt<T_UserLevels>().ToCreate(HttpContext);
|
var modal = parm.Adapt<T_UserLevels>().ToCreate(HttpContext);
|
||||||
|
modal.CreatedAt = DateTime.Now;
|
||||||
|
modal.UpdatedAt = DateTime.Now;
|
||||||
var response = _T_UserLevelsService.AddT_UserLevels(modal);
|
var response = _T_UserLevelsService.AddT_UserLevels(modal);
|
||||||
|
|
||||||
return SUCCESS(response);
|
return SUCCESS(response);
|
||||||
|
|
@ -76,7 +80,17 @@ namespace ZR.Admin.WebApi.Controllers.Liveforum
|
||||||
[Log(Title = "等级配置", BusinessType = BusinessType.UPDATE)]
|
[Log(Title = "等级配置", BusinessType = BusinessType.UPDATE)]
|
||||||
public IActionResult UpdateT_UserLevels([FromBody] T_UserLevelsDto parm)
|
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);
|
var response = _T_UserLevelsService.UpdateT_UserLevels(modal);
|
||||||
|
|
||||||
return ToResponse(response);
|
return ToResponse(response);
|
||||||
|
|
@ -89,7 +103,7 @@ namespace ZR.Admin.WebApi.Controllers.Liveforum
|
||||||
[HttpPost("delete/{ids}")]
|
[HttpPost("delete/{ids}")]
|
||||||
[ActionPermissionFilter(Permission = "tuserlevels:delete")]
|
[ActionPermissionFilter(Permission = "tuserlevels:delete")]
|
||||||
[Log(Title = "等级配置", BusinessType = BusinessType.DELETE)]
|
[Log(Title = "等级配置", BusinessType = BusinessType.DELETE)]
|
||||||
public IActionResult DeleteT_UserLevels([FromRoute]string ids)
|
public IActionResult DeleteT_UserLevels([FromRoute] string ids)
|
||||||
{
|
{
|
||||||
var idArr = Tools.SplitAndConvert<int>(ids);
|
var idArr = Tools.SplitAndConvert<int>(ids);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user