去除忽略项

master
温天培 2 years ago
parent 3a0254a65c
commit d7eb906a72

3
.gitignore vendored

@ -30,8 +30,7 @@ bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/

@ -0,0 +1,46 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Service;
/// <summary>
/// 异常日志参数
/// </summary>
public class ExLogInput : PageInputBase
{
/// <summary>
/// 操作人
/// </summary>
public string Account { get; set; }
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 类名
/// </summary>
public string ClassName { get; set; }
/// <summary>
/// 方法名
/// </summary>
public string MethodName { get; set; }
/// <summary>
/// 异常名称
/// </summary>
public string ExceptionName { get; set; }
/// <summary>
/// 异常信息
/// </summary>
[MaxLength(2000)]
public string ExceptionMsg { get; set; }
/// <summary>
/// 异常时间
/// </summary>
public DateTime ExceptionTime { get; set; }
}

@ -0,0 +1,9 @@
namespace Magic.Core.Service;
/// <summary>
/// 异常日志参数
/// </summary>
public class ExLogOutput : ExLogInput
{
}

@ -0,0 +1,89 @@
using System;
namespace Magic.Core.Service;
/// <summary>
/// 请求日志参数
/// </summary>
public class OpLogInput : PageInputBase
{
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 是否执行成功Y-是N-否)
/// </summary>
public YesOrNot Success { get; set; }
/// <summary>
/// 具体消息
/// </summary>
public string Message { get; set; }
/// <summary>
/// ip
/// </summary>
public string Ip { get; set; }
/// <summary>
/// 地址
/// </summary>
public string Location { get; set; }
/// <summary>
/// 浏览器
/// </summary>
public string Browser { get; set; }
/// <summary>
/// 操作系统
/// </summary>
public string Os { get; set; }
/// <summary>
/// 请求地址
/// </summary>
public string Url { get; set; }
/// <summary>
/// 类名称
/// </summary>
public string ClassName { get; set; }
/// <summary>
/// 方法名称
/// </summary>
public string MethodName { get; set; }
/// <summary>
/// 请求方式GET POST PUT DELETE)
/// </summary>
public string ReqMethod { get; set; }
/// <summary>
/// 请求参数
/// </summary>
public string Param { get; set; }
/// <summary>
/// 返回结果
/// </summary>
public string Result { get; set; }
/// <summary>
/// 耗时(毫秒)
/// </summary>
public long ElapsedTime { get; set; }
/// <summary>
/// 操作时间
/// </summary>
public DateTime OpTime { get; set; }
/// <summary>
/// 操作人
/// </summary>
public string Account { get; set; }
}

@ -0,0 +1,9 @@
namespace Magic.Core.Service;
/// <summary>
/// 请求日志参数
/// </summary>
public class OpLogOutput : OpLogInput
{
}

@ -0,0 +1,59 @@
using System;
namespace Magic.Core.Service;
/// <summary>
/// 访问日志参数
/// </summary>
public class VisLogInput : PageInputBase
{
/// <summary>
/// 名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 是否执行成功Y-是N-否)
/// </summary>
public YesOrNot? Success { get; set; }
/// <summary>
/// 具体消息
/// </summary>
public string Message { get; set; }
/// <summary>
/// IP
/// </summary>
public string Ip { get; set; }
/// <summary>
/// 地址
/// </summary>
public string Location { get; set; }
/// <summary>
/// 浏览器
/// </summary>
public string Browser { get; set; }
/// <summary>
/// 操作系统
/// </summary>
public string Os { get; set; }
/// <summary>
/// 访问类型
/// </summary>
public LoginType VisType { get; set; }
/// <summary>
/// 访问时间
/// </summary>
public DateTime VisTime { get; set; }
/// <summary>
/// 访问人
/// </summary>
public string Account { get; set; }
}

@ -0,0 +1,9 @@
namespace Magic.Core.Service;
/// <summary>
/// 访问日志参数
/// </summary>
public class VisLogOutput : VisLogInput
{
}

@ -0,0 +1,10 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace Magic.Core.Service;
public interface ISysExLogService
{
Task ClearExLog();
Task<dynamic> QueryExLogPageList([FromQuery] ExLogInput input);
}

@ -0,0 +1,10 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace Magic.Core.Service;
public interface ISysOpLogService
{
Task ClearOpLog();
Task<dynamic> QueryOpLogPageList([FromQuery] OpLogInput input);
}

@ -0,0 +1,10 @@
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
namespace Magic.Core.Service;
public interface ISysVisLogService
{
Task ClearVisLog();
Task<dynamic> QueryVisLogPageList([FromQuery] VisLogInput input);
}

@ -0,0 +1,56 @@

using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Magic.Core.Entity;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using System;
using System.Threading.Tasks;
namespace Magic.Core.Service;
/// <summary>
/// 异常日志服务
/// </summary>
[ApiDescriptionSettings(Name = "ExLog", Order = 100)]
public class SysExLogService : ISysExLogService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<SysLogEx> _sysExLogRep; // 操作日志表仓储
public SysExLogService(SqlSugarRepository<SysLogEx> sysExLogRep)
{
_sysExLogRep = sysExLogRep;
}
/// <summary>
/// 分页查询异常日志
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/sysExLog/page")]
public async Task<dynamic> QueryExLogPageList([FromQuery] ExLogInput input)
{
var exLogs = await _sysExLogRep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.ClassName), u => u.ClassName == input.ClassName)
.WhereIF(!string.IsNullOrWhiteSpace(input.MethodName), u => u.MethodName == input.MethodName)
.WhereIF(!string.IsNullOrWhiteSpace(input.ExceptionMsg), u => u.ExceptionMsg.Contains(input.ExceptionMsg.Trim()))
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchBeginTime), u => u.ExceptionTime >= DateTime.Parse(input.SearchBeginTime.Trim()) &&
u.ExceptionTime <= DateTime.Parse(input.SearchEndTime.Trim()))
.OrderBy(u => u.Id, OrderByType.Desc)
.Select<ExLogOutput>()
.ToPagedListAsync(input.PageNo, input.PageSize);
return exLogs.XnPagedResult();
}
/// <summary>
/// 清空异常日志
/// </summary>
/// <returns></returns>
[HttpPost("/sysExLog/delete")]
public async Task ClearExLog()
{
await _sysExLogRep.DeleteAsync(m => true);
}
}

@ -0,0 +1,55 @@

using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Magic.Core.Entity;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using System;
using System.Threading.Tasks;
namespace Magic.Core.Service;
/// <summary>
/// 操作日志服务
/// </summary>
[ApiDescriptionSettings(Name = "OpLog", Order = 100)]
public class SysOpLogService : ISysOpLogService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<SysLogOp> _sysOpLogRep; // 操作日志表仓储
public SysOpLogService(SqlSugarRepository<SysLogOp> sysOpLogRep)
{
_sysOpLogRep = sysOpLogRep;
}
/// <summary>
/// 分页查询操作日志
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/sysOpLog/page")]
public async Task<dynamic> QueryOpLogPageList([FromQuery] OpLogInput input)
{
var opLogs = await _sysOpLogRep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name.Trim()))
.WhereIF(Enum.IsDefined(typeof(YesOrNot),input.Success), u => u.Success == input.Success)
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchBeginTime), u => u.OpTime >= DateTime.Parse(input.SearchBeginTime.Trim()) && u.OpTime <= DateTime.Parse(input.SearchEndTime.Trim()))
.OrderBy(u => u.Id, OrderByType.Desc)
.Select<OpLogOutput>()
.ToPagedListAsync(input.PageNo, input.PageSize);
return opLogs.XnPagedResult();
}
/// <summary>
/// 清空操作日志
/// </summary>
/// <returns></returns>
[HttpPost("/sysOpLog/delete")]
public async Task ClearOpLog()
{
await _sysOpLogRep.DeleteAsync(m => true);
}
}

@ -0,0 +1,55 @@

using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Magic.Core.Entity;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using System;
using System.Threading.Tasks;
namespace Magic.Core.Service;
/// <summary>
/// 访问日志服务
/// </summary>
[ApiDescriptionSettings(Name = "VisLog", Order = 100)]
public class SysVisLogService : ISysVisLogService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<SysLogVis> _sysVisLogRep; // 访问日志表仓储
public SysVisLogService(SqlSugarRepository<SysLogVis> sysVisLogRep)
{
_sysVisLogRep = sysVisLogRep;
}
/// <summary>
/// 分页查询访问日志
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
[HttpGet("/sysVisLog/page")]
public async Task<dynamic> QueryVisLogPageList([FromQuery] VisLogInput input)
{
var visLogs = await _sysVisLogRep.AsQueryable()
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), u => u.Name.Contains(input.Name))
.WhereIF(input.VisType > 0, u => u.VisType == input.VisType)
.WhereIF(input.Success != null && Enum.IsDefined(typeof(YesOrNot), input.Success), u => u.Success == input.Success)
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchBeginTime), u => u.VisTime >= DateTime.Parse(input.SearchBeginTime.Trim()) && u.VisTime <= DateTime.Parse(input.SearchEndTime.Trim()))
.OrderBy(u => u.Id, OrderByType.Desc)
.Select<VisLogOutput>()
.ToPagedListAsync(input.PageNo, input.PageSize);
return visLogs.XnPagedResult();
}
/// <summary>
/// 清空访问日志
/// </summary>
/// <returns></returns>
[HttpPost("/sysVisLog/delete")]
public async Task ClearVisLog()
{
await _sysVisLogRep.DeleteAsync(m => true);
}
}
Loading…
Cancel
Save