|
@@ -81,7 +81,11 @@ namespace DataSharing.FwDataExchange
|
|
|
var configSendDataOld = channelconfigManager.GetConfigurationSendDataOld();
|
|
|
string url = $"api/token?ClientID={configSendDataOld.ClientID}&Secret={configSendDataOld.Secret}";
|
|
|
|
|
|
- var toke = await httpInvoker.RequestStringContentAsync<FwToken>(configSendDataOld.AddressUrl + url, "Get",
|
|
|
+ var baseAddress = configSendDataOld.AddressUrl;
|
|
|
+ if (!baseAddress.EndsWith('/'))
|
|
|
+ baseAddress += "/";
|
|
|
+
|
|
|
+ var toke = await httpInvoker.RequestStringContentAsync<FwToken>(baseAddress + url, "Get",
|
|
|
null, d => d.SetHttpClient(configSendDataOld.AddressUrl), cancellationToken);
|
|
|
|
|
|
if (toke is null || toke.data is null)
|
|
@@ -93,22 +97,22 @@ namespace DataSharing.FwDataExchange
|
|
|
return dataToken;
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 请求,不带token
|
|
|
- /// </summary>
|
|
|
- /// <typeparam name="TResponse"></typeparam>
|
|
|
- /// <param name="url"></param>
|
|
|
- /// <param name="httpMethod"></param>
|
|
|
- /// <param name="stringContent"></param>
|
|
|
- /// <param name="cancellationToken"></param>
|
|
|
- /// <returns></returns>
|
|
|
+ /// <summary>
|
|
|
+ /// 请求,不带token
|
|
|
+ /// </summary>
|
|
|
+ /// <typeparam name="TResponse"></typeparam>
|
|
|
+ /// <param name="url"></param>
|
|
|
+ /// <param name="httpMethod"></param>
|
|
|
+ /// <param name="stringContent"></param>
|
|
|
+ /// <param name="cancellationToken"></param>
|
|
|
+ /// <returns></returns>
|
|
|
public async Task<TResponse?> RequestNoTokenAsync<TResponse>(string url, string httpMethod, string? stringContent = null, CancellationToken cancellationToken = default)
|
|
|
{
|
|
|
using var scope = _scopeFactory.CreateScope();
|
|
|
var provider = scope.ServiceProvider;
|
|
|
var channelconfigManager = provider.GetRequiredService<IChannelConfigurationManager>();
|
|
|
var httpInvoker = provider.GetRequiredService<IHttpInvoker>();
|
|
|
-
|
|
|
+
|
|
|
var configHotlineClient = channelconfigManager.GetConfigurationHotlineClient();
|
|
|
var postUrl = configHotlineClient.AddressUrl + url;
|
|
|
return await httpInvoker.RequestStringContentAsync<TResponse>(postUrl, httpMethod, stringContent,
|