李昊 4 年之前
父节点
当前提交
ebea75203e

+ 1 - 1
gx_api/GxPress/Api/GxPress.Api/ExceptionMiddleware.cs

@@ -45,7 +45,7 @@ namespace GxPress.Api
                         var userId = _contextAccessor?.HttpContext?.User?.FindFirst(ClaimTypes.NameIdentifier);
                         if (int.TryParse(userId?.Value, out var accountId))
                         {
-                            _apiLogService.DataSave(context, 1, accountId);
+                           await _apiLogService.DataSave(context, 1, accountId);
                         }
                     }
                     // watch.Stop();

+ 2 - 1
gx_api/GxPress/Service/GxPress.Service.Implement/ApiLogService.cs

@@ -1,5 +1,6 @@
 using System;
 using System.IO;
+using System.Threading.Tasks;
 using Datory;
 using GxPress.Common.AppOptions;
 using GxPress.Common.Tools;
@@ -29,7 +30,7 @@ namespace GxPress.Service.Implement
             _userRepository = new Repository<User>(database);
         }
 
-        public async void DataSave(HttpContext context, long responseTime, int userId)
+        public async Task DataSave(HttpContext context, long responseTime, int userId)
         {
             var isLog = _configuration.GetValue<bool>("ApiLog:IsEnable");
             // if (isLog)

+ 2 - 1
gx_api/GxPress/Service/GxPress.Service.Interface/IApiLogService.cs

@@ -1,9 +1,10 @@
+using System.Threading.Tasks;
 using Microsoft.AspNetCore.Http;
 
 namespace GxPress.Service.Interface
 {
     public interface IApiLogService
     {
-       void  DataSave(HttpContext context, long responseTime,int userId);
+       Task DataSave(HttpContext context, long responseTime,int userId);
     }
 }