46 lines
1.5 KiB
C#
46 lines
1.5 KiB
C#
using Dlhis.Middle.Entities;
|
|
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
|
|
|
|
namespace Dlhis.Middle.Services.Implements;
|
|
|
|
public class RemoteOrderService : IRemoteOrderService
|
|
{
|
|
private readonly IHealthCheckService _healthCheckService;
|
|
private readonly IDbContext _dbContext;
|
|
|
|
public RemoteOrderService(
|
|
IHealthCheckService healthCheckService,
|
|
IDbContext dbContext)
|
|
{
|
|
_healthCheckService = healthCheckService;
|
|
_dbContext = dbContext;
|
|
}
|
|
|
|
|
|
///// <inheritdoc />
|
|
// public async Task<DefaultApiResult<OrderResultResponse>> AddAsync(OrderAddRequest request)
|
|
// {
|
|
// var token = await _tokenService.AuthAsync();
|
|
//
|
|
// var httpClient = _httpClientFactory.CreateClient("face");
|
|
// httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
|
|
//
|
|
// var content = new StringContent(request.ToJson(), Encoding.UTF8, "application/json");
|
|
//
|
|
// var response = await httpClient.PostAsync($"{_settingService.GetBaseUrl()}/api/canteen/orders", content);
|
|
//
|
|
// var responseJson = await response.Content.ReadAsStringAsync();
|
|
// return responseJson.ToObject<DefaultApiResult<OrderResultResponse>>();
|
|
// }
|
|
|
|
/// <inheritdoc />
|
|
public async Task<bool> AbleRemoteCallAsync()
|
|
{
|
|
if (await _dbContext.Queryable<LocalBalanceRecordEntity>().AnyAsync(x => !x.IsSync))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return !_healthCheckService.GetIsOffline();
|
|
}
|
|
} |