fix log
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Canteen.Entities;
|
||||
using System.Diagnostics;
|
||||
using Dlhis.Entity.Canteen.Enums;
|
||||
using Dlhis.Entity.Device.Entities;
|
||||
using Dlhis.Middle.Entities;
|
||||
using Kurisu.AspNetCore.Utils;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
@@ -19,6 +17,7 @@ public class OrderService : IOrderService
|
||||
{
|
||||
private readonly ICanteenSettingService _canteenSettingService;
|
||||
private readonly IRemoteOrderService _remoteOrderService;
|
||||
private readonly ILogger<OrderService> _logger;
|
||||
private readonly string _factory;
|
||||
private readonly IDbContext _dbContext;
|
||||
private Dictionary<CanteenSettingItemEnumType, string> _settings;
|
||||
@@ -26,15 +25,21 @@ public class OrderService : IOrderService
|
||||
public OrderService(ICanteenSettingService canteenSettingService,
|
||||
IRemoteOrderService remoteOrderService,
|
||||
IConfiguration configuration,
|
||||
ILogger<OrderService> logger,
|
||||
IDbContext dbContext)
|
||||
{
|
||||
_canteenSettingService = canteenSettingService;
|
||||
_remoteOrderService = remoteOrderService;
|
||||
_logger = logger;
|
||||
_factory = configuration.GetSection("Factory").Value;
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<DefaultApiResult<OrderResultResponse>> AddAsync(OrderAddRequest request)
|
||||
{
|
||||
var sw = Stopwatch.StartNew();
|
||||
|
||||
try
|
||||
{
|
||||
if (await _remoteOrderService.AbleRemoteCallAsync())
|
||||
{
|
||||
@@ -99,6 +104,11 @@ public class OrderService : IOrderService
|
||||
Msg = message
|
||||
};
|
||||
}
|
||||
finally
|
||||
{
|
||||
_logger.LogInformation("消费请求:{json}. 耗时:{time}", request.ToJson(), sw.ElapsedMilliseconds);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user