Files
QYZH.InteractiveMagazine/QYZH.InteractiveMagazine.WebApi/Controllers/OperationLogController.cs
glz 78b686f9e5 refactor: 批量新增枚举类型并完成实体、DTO、服务层枚举替换
- 新增30+业务枚举类型覆盖用户、宠物、商城、社区、积分等模块
- 完成实体类、DTO、服务层的字符串枚举替换为强类型枚举
- 修复用户状态枚举名称变更,将Frozen改为Disabled
- 新增批量发布社区消息接口与控制器实现
- 新增操作日志、积分管理、补偿任务相关服务与DTO
2026-06-08 16:57:44 +08:00

70 lines
2.3 KiB
C#

using Microsoft.AspNetCore.Mvc;
using QYZH.InteractiveMagazine.IService;
using QYZH.InteractiveMagazine.Models.Common;
using QYZH.InteractiveMagazine.Models.Dto;
namespace QYZH.InteractiveMagazine.WebApi.Controllers;
/// <summary>
/// 操作日志控制器
/// </summary>
[Route("api/[controller]")]
[ApiController]
public class OperationLogController : BaseController
{
private readonly IOperationLogService _operationLogService;
private readonly ILogger<OperationLogController> _logger;
public OperationLogController(IOperationLogService operationLogService, ILogger<OperationLogController> logger)
{
_operationLogService = operationLogService;
_logger = logger;
}
/// <summary>
/// 分页查询操作日志
/// </summary>
[HttpPost("list")]
public async Task<BaseResponse<PageListModel<OperationLogOutput>>> GetList([FromBody] OperationLogQueryInput input)
{
try
{
var result = await _operationLogService.GetListAsync(input);
return Success(result);
}
catch (BusinessException ex)
{
_logger.LogWarning(ex, "查询操作日志业务异常: {Message}", ex.Message);
return BaseResponse<PageListModel<OperationLogOutput>>.Fail(ex.Message);
}
catch (Exception ex)
{
_logger.LogError(ex, "查询操作日志系统异常");
return BaseResponse<PageListModel<OperationLogOutput>>.Fail("查询操作日志失败,请稍后重试");
}
}
/// <summary>
/// 获取操作日志详情
/// </summary>
[HttpGet("{id}")]
public async Task<BaseResponse<OperationLogDetailOutput>> GetDetail(long id)
{
try
{
var result = await _operationLogService.GetDetailAsync(id);
return Success(result);
}
catch (BusinessException ex)
{
_logger.LogWarning(ex, "查询操作日志详情业务异常: {Message}", ex.Message);
return BaseResponse<OperationLogDetailOutput>.Fail(ex.Message);
}
catch (Exception ex)
{
_logger.LogError(ex, "查询操作日志详情系统异常");
return BaseResponse<OperationLogDetailOutput>.Fail("查询操作日志详情失败,请稍后重试");
}
}
}