feat 消息推送api

This commit is contained in:
2025-03-06 16:04:08 +08:00
parent 413a3ae77d
commit 7e71884b32
10 changed files with 259 additions and 1 deletions

View File

@@ -15,4 +15,51 @@ public class Startup : DefaultStartup
{
IdentityModelEventSource.ShowPII = true;
}
/// <inheritdoc />
public override void ConfigureServices(IServiceCollection services)
{
base.ConfigureServices(services);
services.AddHttpClient("jinko.oa", (_, _) => { })
.ConfigurePrimaryHttpMessageHandler(() =>
{
var handler = new HttpClientHandler
{
ClientCertificateOptions = ClientCertificateOption.Manual,
ServerCertificateCustomValidationCallback = (_, _, _, _) => true
};
return handler;
});
services.AddHttpClient("jinko.httpclient", (sp, httpClient) =>
{
// "BaseUrl": "https://oapi.dingtalk.com",
// "AgentId": "2768073678",
// "AppId": "dingumelppews6rah7x9",
// "AppSecret": "nsWfJTVjYesHVzrLiP-t1TQqMQvC1L_kZNfXfnIyzcXK4pCTfKprkjZcxAbsDR_l",
httpClient.BaseAddress = new Uri("https://oapi.dingtalk.com");
httpClient.Timeout = TimeSpan.FromSeconds(30);
})
// .SetHandlerLifetime(TimeSpan.FromMinutes(5))
// .addd((res) =>
// {
// return HttpPolicyExtensions
// .HandleTransientHttpError()
// .OrResult(msg => msg.StatusCode != HttpStatusCode.OK)
// .WaitAndRetryAsync(6, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt)));
// })
.ConfigurePrimaryHttpMessageHandler(() =>
{
var handler = new HttpClientHandler
{
ClientCertificateOptions = ClientCertificateOption.Manual,
ServerCertificateCustomValidationCallback = (_, _, _, _) => true
};
return handler;
});
}
}