|
|
@@ -27,6 +27,11 @@ namespace Admin.NET.Core
|
|
|
|
|
|
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
|
|
|
{
|
|
|
+ var sw = new Stopwatch();
|
|
|
+ sw.Start();
|
|
|
+ var actionContext = await next();
|
|
|
+ sw.Stop();
|
|
|
+
|
|
|
// 是否开启操作日志
|
|
|
var value = await App.GetService<SysConfigService>().GetConfigCache(CommonConst.SysOpLogFlag);
|
|
|
if (string.IsNullOrWhiteSpace(value) || !bool.Parse(value)) return;
|
|
|
@@ -34,11 +39,6 @@ namespace Admin.NET.Core
|
|
|
var httpContext = context.HttpContext;
|
|
|
var httpRequest = httpContext.Request;
|
|
|
|
|
|
- var sw = new Stopwatch();
|
|
|
- sw.Start();
|
|
|
- var actionContext = await next();
|
|
|
- sw.Stop();
|
|
|
-
|
|
|
var isRequestSucceed = actionContext.Exception == null; // 判断是否请求成功(没有异常就是成功)
|
|
|
var headers = httpRequest.Headers;
|
|
|
var clientInfo = headers.ContainsKey("User-Agent") ? Parser.GetDefault().Parse(headers["User-Agent"]) : null;
|