fix: 增加日志
This commit is contained in:
@@ -19,6 +19,7 @@ public class AliyunClient : IAliyunClient
|
||||
{
|
||||
private readonly IHttpClientFactory _httpClientFactory;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ILogger<AliyunClient> _logger;
|
||||
private readonly string _accessKeyId;
|
||||
private readonly string _accessKeySecret;
|
||||
|
||||
@@ -29,7 +30,7 @@ public class AliyunClient : IAliyunClient
|
||||
{
|
||||
_httpClientFactory = httpClientFactory;
|
||||
_configuration = configuration;
|
||||
|
||||
_logger = logger;
|
||||
_accessKeyId = "LTAI5tAqyWKcBcSvzpc1ZM72";
|
||||
_accessKeySecret = "YZMSqsmMGlGZuHw5WU2tqt0mmIBX6h";
|
||||
}
|
||||
@@ -70,13 +71,14 @@ public class AliyunClient : IAliyunClient
|
||||
var url = $"https://{Endpoint}/?Signature={PercentEncode(signature)}";
|
||||
var bodyString = BuildBodyString(parameters);
|
||||
|
||||
using var fallbackClient = _httpClientFactory == null ? new HttpClient() : null;
|
||||
var client = _httpClientFactory?.CreateClient() ?? fallbackClient;
|
||||
var client = _httpClientFactory.CreateClient();
|
||||
client.DefaultRequestHeaders.Add("Host", Endpoint);
|
||||
var content = new StringContent(bodyString, Encoding.UTF8, "application/x-www-form-urlencoded");
|
||||
var response = await client.PostAsync(url, content);
|
||||
var rawResponse = await response.Content.ReadAsStringAsync();
|
||||
|
||||
_logger.LogInformation("Aliyun Id3MetaVerify response:{UserName} , {RawResponse}", userName, rawResponse);
|
||||
|
||||
return ParseResponse(rawResponse);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user