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

@@ -0,0 +1,23 @@
using Kurisu.RemoteCall.Abstractions;
namespace Dlhis.Middle.Apis.Handlers;
public class ClientHandler : IHttpRemoteCallPolicyHandler
{
/// <inheritdoc />
public IHttpClientBuilder ConfigureHttpClient(IHttpClientBuilder builder)
{
builder.ConfigureHttpClient(client => { client.Timeout = TimeSpan.FromSeconds(10); }).ConfigurePrimaryHttpMessageHandler(() =>
{
var handler = new HttpClientHandler
{
ClientCertificateOptions = ClientCertificateOption.Manual,
ServerCertificateCustomValidationCallback = (_, _, _, _) => true
};
return handler;
});
return builder;
}
}

View File

@@ -0,0 +1,14 @@
using Dlhis.Middle.Services;
using Kurisu.RemoteCall.Abstractions;
namespace Dlhis.Middle.Apis.Handlers;
public class FaceBearerTokenHandler : IAsyncAuthTokenHandler
{
/// <inheritdoc />
public async Task<string> GetTokenAsync(IServiceProvider serviceProvider)
{
var tokenService = serviceProvider.GetService<ITokenService>();
return await tokenService.AuthAsync();
}
}

View File

@@ -0,0 +1,16 @@
using Dlhis.Middle.Apis.Handlers;
using Dlhis.Middle.Request;
using Dlhis.Middle.Response;
using Kurisu.AspNetCore.UnifyResultAndValidation;
using Kurisu.RemoteCall.Attributes;
namespace Dlhis.Middle.Apis;
[RequestLog]
[EnableRemoteClient(Name = "face-service", BaseUrl = "${BaseUrl}", PolicyHandler = typeof(ClientHandler))]
public interface IAssignmentDeviceTaskApi
{
[Auth(TokenHandler = typeof(FaceBearerTokenHandler))]
[Post("/api/scheduled/assignments/deviceTasks")]
Task<DefaultApiResult<List<DeviceTaskToDeviceByDeviceResponse>>> DeviceGetTasksAsync(DeviceTaskGetRequest request);
}

View File

@@ -0,0 +1,30 @@
using Dlhis.Middle.Apis.Handlers;
using Dlhis.Middle.Entities;
using Dlhis.Middle.Request;
using Dlhis.Middle.Response;
using Kurisu.AspNetCore.DataAccess.Dto;
using Kurisu.AspNetCore.UnifyResultAndValidation;
using Kurisu.RemoteCall.Attributes;
namespace Dlhis.Middle.Apis;
[RequestLog]
[EnableRemoteClient(Name = "face-service", BaseUrl = "${BaseUrl}", PolicyHandler = typeof(ClientHandler))]
public interface ICanteenApi
{
[Auth(TokenHandler = typeof(FaceBearerTokenHandler))]
[Post("/api/canteen/orders")]
Task<DefaultApiResult<OrderResultResponse>> AddAsync(OrderAddRequest request);
[Auth(TokenHandler = typeof(FaceBearerTokenHandler))]
[Post("/api/canteen/middle/upload")]
Task<DefaultApiResult<OrderResultResponse>> UploadAsync(LocalBalanceRecordEntity entity);
[Auth(TokenHandler = typeof(FaceBearerTokenHandler))]
[Post("/api/canteen/balances/device/page")]
Task<DefaultApiResult<Pagination<BalanceRecordDeviceResponse>>> GetPageByDeviceUniqueNoAsync(BalanceRecordPageByDeviceUniqueNoRequest request);
[Auth(TokenHandler = typeof(FaceBearerTokenHandler))]
[Post("/api/canteen/balances/refund")]
Task<DefaultApiResult<OrderResultResponse>> RefundAsync(BalanceRecordRefundRequest request);
}

View File

@@ -0,0 +1,22 @@
using Dlhis.Middle.Apis.Handlers;
using Dlhis.Middle.Request;
using Dlhis.Middle.Response;
using Kurisu.AspNetCore.UnifyResultAndValidation;
using Kurisu.RemoteCall.Attributes;
namespace Dlhis.Middle.Apis;
[EnableRemoteClient(Name = "face-service", BaseUrl = "${BaseUrl}", PolicyHandler = typeof(ClientHandler))]
public interface ICommonApi
{
[Post("/api/user/oauth2/clientgrant")]
public Task<DefaultApiResult<TokenResponse>> AuthAsync(object request);
[Auth(TokenHandler = typeof(FaceBearerTokenHandler))]
[Post("/api/common/middles/healthz")]
public Task<DefaultApiResult> CheckHealthAsync(HealthCheckRequest request);
[Auth(TokenHandler = typeof(FaceBearerTokenHandler))]
[Get("/api/common/SysData/download")]
public Task<DefaultApiResult<List<T>>> DownloadAsync<T>(string factory, string tableName);
}