Core + Vue 后台管理基础框架6——业务日志
1、前言 上一篇,我们讲了审计日志,重点是重点业务表的审计字段。还有一种系统审计,就是重点业务对象的改动记录,是以审计日志表中的记录形式存在的。这种审计记录一般需要精确定位到某个终结点,最合适的实现方式就是操作过滤器。 2、实现 自定义操作过滤器: public class LogAttribute : ActionFilterAttribute { public string LogName { get; private set; } public LogAttribute(string logName) { this.LogName = logName; } public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { await base.OnActionExecutionAsync(context, next); var user = context.HttpContext.RequestServices.GetService<CurrentUser>(); var log = new SysOperationLogDto { ClassName = context.Controller