req itfx
This commit is contained in:
parent
57d33c47b5
commit
99828d4b91
@ -26,6 +26,7 @@ public class InterfaceForwardService : ITransientDependency
|
|||||||
|
|
||||||
var body = data.ToJson();
|
var body = data.ToJson();
|
||||||
var content = new StringContent(body);
|
var content = new StringContent(body);
|
||||||
|
content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");
|
||||||
if (Track2InterfaceRelayAppContext.Current == null)
|
if (Track2InterfaceRelayAppContext.Current == null)
|
||||||
{
|
{
|
||||||
throw new BusinessException(message: $"请在{nameof(Track2InterfaceRelayAppContext)}中调用接口通");
|
throw new BusinessException(message: $"请在{nameof(Track2InterfaceRelayAppContext)}中调用接口通");
|
||||||
@ -40,10 +41,17 @@ public class InterfaceForwardService : ITransientDependency
|
|||||||
|
|
||||||
content.Headers.Add(nameof(InterfaceForwardOptions.AppKey), key);
|
content.Headers.Add(nameof(InterfaceForwardOptions.AppKey), key);
|
||||||
content.Headers.Add(nameof(InterfaceForwardOptions.AppSecret), secret);
|
content.Headers.Add(nameof(InterfaceForwardOptions.AppSecret), secret);
|
||||||
|
content.Headers.Add(nameof(resSubscribeName), resSubscribeName);
|
||||||
|
content.Headers.Add(nameof(attach), attach);
|
||||||
|
content.Headers.Add(nameof(isReturnMessage), isReturnMessage.ToString());
|
||||||
|
|
||||||
using var response = await client.PostAsync("InterfaceForward/BatchForwardThenPushToQueue", content);
|
using var response = await client.PostAsync($"InterfaceForward/BatchForwardThenPushToQueue?upStreamCode={upStreamCode}&serviceProvidercode={serviceProviderCode}", content);
|
||||||
|
|
||||||
var res = await response.Content.ReadAsStringAsync();
|
var res = await response.Content.ReadAsStringAsync();
|
||||||
|
if (!response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
throw new BusinessException(message: $"返回的状态码有问题: {response.StatusCode}, {response.ReasonPhrase}");
|
||||||
|
}
|
||||||
|
|
||||||
return res.ToObject<InterfaceRelayUnifyResultDto>()!;
|
return res.ToObject<InterfaceRelayUnifyResultDto>()!;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user