You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
2.7 KiB
C#

5 months ago
using System;
using System.Threading.Tasks;
using Infrastructure;
using Microsoft.AspNetCore.Mvc;
using OpenAuth.App;
using OpenAuth.App.Request;
using OpenAuth.App.Response;
using OpenAuth.Repository.Domain;
namespace OpenAuth.WebApi.Controllers
{
/// <summary>
/// 系统日志
/// </summary>
[Route("api/[controller]/[action]")]
[ApiController]
//[ApiExplorerSettings(GroupName = "系统日志_SysLogs")]
3 months ago
public class SysLogsController : ControllerBase
5 months ago
{
private readonly SysLogApp _app;
3 months ago
5 months ago
//获取详情
[HttpGet]
public Response<SysLog> Get(string id)
{
var result = new Response<SysLog>();
try
{
result.Result = _app.Get(id);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
/// <summary>
/// 添加
/// </summary>
3 months ago
[HttpPost]
5 months ago
public Response Add(SysLog obj)
{
var result = new Response();
try
{
_app.Add(obj);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
3 months ago
5 months ago
/// <summary>
/// 修改日志(建议废弃)
/// </summary>
[HttpPost]
public Response Update(SysLog obj)
{
var result = new Response();
try
{
_app.Update(obj);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
/// <summary>
/// 加载列表
/// </summary>
[HttpGet]
3 months ago
public async Task<TableData> Load([FromQuery] QuerySysLogListReq request)
5 months ago
{
return await _app.Load(request);
}
/// <summary>
/// 批量删除
/// </summary>
3 months ago
[HttpPost]
public Response Delete([FromBody] string[] ids)
5 months ago
{
var result = new Response();
try
{
_app.Delete(ids);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
3 months ago
public SysLogsController(SysLogApp app)
5 months ago
{
_app = app;
}
}
}