fix 多钱包调整

This commit is contained in:
2024-11-08 16:36:10 +08:00
parent 36bfd2e8f6
commit 1a0ba28249
36 changed files with 418 additions and 434 deletions

View File

@@ -1,5 +1,6 @@
using System.Diagnostics;
using Dlhis.Entity.Canteen.Enums;
using Dlhis.Middle.Apis;
using Dlhis.Middle.Entities;
using Kurisu.AspNetCore.Utils;
using Kurisu.AspNetCore.Utils.Extensions;
@@ -17,6 +18,7 @@ public class OrderService : IOrderService
{
private readonly ICanteenSettingService _canteenSettingService;
private readonly IRemoteOrderService _remoteOrderService;
private readonly ICanteenApi _canteenApi;
private readonly ILogger<OrderService> _logger;
private readonly string _factory;
private readonly IDbContext _dbContext;
@@ -24,14 +26,16 @@ public class OrderService : IOrderService
public OrderService(ICanteenSettingService canteenSettingService,
IRemoteOrderService remoteOrderService,
IConfiguration configuration,
ISettingService settingService,
ICanteenApi canteenApi,
ILogger<OrderService> logger,
IDbContext dbContext)
{
_canteenSettingService = canteenSettingService;
_remoteOrderService = remoteOrderService;
_canteenApi = canteenApi;
_logger = logger;
_factory = configuration.GetSection("Factory").Value;
_factory = settingService.GetFactories().Join(",");
_dbContext = dbContext;
}
@@ -43,12 +47,12 @@ public class OrderService : IOrderService
{
if (await _remoteOrderService.AbleRemoteCallAsync())
{
var remoteResult = await _remoteOrderService.AddAsync(request);
var remoteResult = await _canteenApi.AddAsync(request);
if (remoteResult.Code == ApiStateCode.Success)
{
var d = remoteResult.Data;
await _dbContext.Updateable<LocalGainfoMealEntity>()
.SetColumns(x => x.Balance == d.Balance)
.SetColumns(x => x.Balance == d.TotalBalance)
.Where(x => x.UserCode == d.UserCode)
.ExecuteCommandAsync();
}