feat: 增加开启是否校验
This commit is contained in:
@@ -37,6 +37,7 @@ public class OrderService : IOrderService
|
||||
private readonly IOrderCommonHandler _orderCommonHandler;
|
||||
private readonly INamedResolver _namedResolver;
|
||||
private readonly ILogger<OrderService> _logger;
|
||||
private readonly bool _enableConsumeVerify;
|
||||
|
||||
public OrderService(ICanteenSettingService canteenSettingService,
|
||||
IDbContext dbContext,
|
||||
@@ -47,6 +48,7 @@ public class OrderService : IOrderService
|
||||
IGainfoPermissionApi gainfoPermissionApi,
|
||||
IOrderCommonHandler orderCommonHandler,
|
||||
INamedResolver namedResolver,
|
||||
IConfiguration configuration,
|
||||
ILogger<OrderService> logger)
|
||||
{
|
||||
_canteenSettingService = canteenSettingService;
|
||||
@@ -58,6 +60,7 @@ public class OrderService : IOrderService
|
||||
_gainfoPermissionApi = gainfoPermissionApi;
|
||||
_orderCommonHandler = orderCommonHandler;
|
||||
_namedResolver = namedResolver;
|
||||
_enableConsumeVerify = configuration.GetValue("Canteen:EnableConsumeVerify", false);
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -394,8 +397,11 @@ public class OrderService : IOrderService
|
||||
|
||||
await _orderCommonHandler.TryConsumeAsync(order.Id, async () =>
|
||||
{
|
||||
//校验 todo
|
||||
//await Verify(order);
|
||||
if (_enableConsumeVerify)
|
||||
{
|
||||
await Verify(order);
|
||||
}
|
||||
|
||||
await _balanceRepository.ConsumeBalanceAsync(order.UserCode, order.Amount);
|
||||
|
||||
//写入记录
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"Canteen": {
|
||||
"EnableConsumeVerify": false
|
||||
},
|
||||
"InternalRequest": {
|
||||
"CommonRequestUrl": "http://common",
|
||||
"BasicRequestUrl": "http://basic",
|
||||
|
||||
Reference in New Issue
Block a user