Merge branch 'dev/dev_xp' into dev/dev
This commit is contained in:
@@ -14,14 +14,14 @@ import org.springframework.stereotype.Component;
|
||||
public class SendRequestUtil {
|
||||
|
||||
@Value("${ALIYUN_API_KEY}")
|
||||
private String AliYunAPIKey;
|
||||
private String ALIYUN_API_KEY;
|
||||
@Value("${FREEPIK_API_KEY}")
|
||||
private String freepikAPIKey;
|
||||
private String FREEPIK_API_KEY;
|
||||
|
||||
public String sendAliYunPostAsync(String apiUrl, String requestBody){
|
||||
// 发送POST请求 todo 异常处理
|
||||
HttpResponse execute = HttpRequest.post(apiUrl)
|
||||
.header(Header.AUTHORIZATION, "Bearer " + AliYunAPIKey)
|
||||
.header(Header.AUTHORIZATION, "Bearer " + ALIYUN_API_KEY)
|
||||
.header("X-DashScope-Async", "enable")
|
||||
.header(Header.CONTENT_TYPE, "application/json")
|
||||
.body(requestBody)
|
||||
@@ -42,7 +42,7 @@ public class SendRequestUtil {
|
||||
// 发送POST请求 todo 异常处理
|
||||
HttpResponse execute = HttpRequest.post(FREE_PIK)
|
||||
.header(Header.CONTENT_TYPE, "application/json")
|
||||
.header("x-freepik-api-key", freepikAPIKey)
|
||||
.header("x-freepik-api-key", FREEPIK_API_KEY)
|
||||
.body(requestBody)
|
||||
.timeout(20000) // 设置超时时间20秒
|
||||
.execute();
|
||||
@@ -57,7 +57,7 @@ public class SendRequestUtil {
|
||||
public String sendAliYunGet(String fullUrl){
|
||||
// 发送GET请求 todo 异常处理
|
||||
HttpResponse httpResponse = HttpRequest.get(fullUrl)
|
||||
.header(Header.AUTHORIZATION, "Bearer " + AliYunAPIKey)
|
||||
.header(Header.AUTHORIZATION, "Bearer " + ALIYUN_API_KEY)
|
||||
.timeout(20000) // 设置超时时间20秒
|
||||
.execute();
|
||||
int status = httpResponse.getStatus();
|
||||
|
||||
Reference in New Issue
Block a user