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