fix 多钱包调整
This commit is contained in:
23
Src/Dlhis.Middle/Apis/Handlers/ClientHandler.cs
Normal file
23
Src/Dlhis.Middle/Apis/Handlers/ClientHandler.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
14
Src/Dlhis.Middle/Apis/Handlers/FaceBearerTokenHandler.cs
Normal file
14
Src/Dlhis.Middle/Apis/Handlers/FaceBearerTokenHandler.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
16
Src/Dlhis.Middle/Apis/IAssignmentDeviceTaskApi.cs
Normal file
16
Src/Dlhis.Middle/Apis/IAssignmentDeviceTaskApi.cs
Normal 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);
|
||||
}
|
||||
30
Src/Dlhis.Middle/Apis/ICanteenApi.cs
Normal file
30
Src/Dlhis.Middle/Apis/ICanteenApi.cs
Normal 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);
|
||||
}
|
||||
22
Src/Dlhis.Middle/Apis/ICommonApi.cs
Normal file
22
Src/Dlhis.Middle/Apis/ICommonApi.cs
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user