电梯调整等
This commit is contained in:
@@ -116,21 +116,23 @@ namespace Tnb.Common.Utils
|
||||
{
|
||||
Log.Information($"开始请求 {url} 请求参数: {JsonConvert.SerializeObject(pars)}");
|
||||
}
|
||||
HttpClient Client = new HttpClient();
|
||||
var reqUri = url;
|
||||
if (pars?.Count > 0)
|
||||
using (HttpClient Client = new HttpClient())
|
||||
{
|
||||
reqUri = QueryHelpers.AddQueryString(url, pars);
|
||||
//await Console.Out.WriteLineAsync(reqUri);
|
||||
var reqUri = url;
|
||||
if (pars?.Count > 0)
|
||||
{
|
||||
reqUri = QueryHelpers.AddQueryString(url, pars);
|
||||
//await Console.Out.WriteLineAsync(reqUri);
|
||||
}
|
||||
Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
var respBody = await Client.GetAsync(reqUri);
|
||||
var result = await respBody.Content.ReadAsStringAsync();
|
||||
if (isLog)
|
||||
{
|
||||
Log.Information($"请求 {url} 参数: {JsonConvert.SerializeObject(pars)} 结果: {result}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
|
||||
var respBody = await Client.GetAsync(reqUri);
|
||||
var result = await respBody.Content.ReadAsStringAsync();
|
||||
if (isLog)
|
||||
{
|
||||
Log.Information($"请求 {url} 结果: {result}");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static async Task<string> GetAsync(string url, Dictionary<string, string> headers = null, Dictionary<string, string> pars = null)
|
||||
|
||||
Reference in New Issue
Block a user