fix: 修复更换omada参数问题
This commit is contained in:
@@ -74,6 +74,15 @@ public class FeignConfig implements RequestInterceptor {
|
||||
authorization = PRE_ACCESS_TOKEN + cacheAccessToken;
|
||||
}
|
||||
if (StrUtil.isNotBlank(authorization)) {
|
||||
// 更新最新的omadaUrl和omadacId
|
||||
requestTemplate.target(omadaProperties.getOmadaUrl());
|
||||
String path = requestTemplate.path();
|
||||
String uri = path.substring(path.indexOf("/openapi/v1/") + 12);
|
||||
String lastUri = uri.substring(uri.indexOf("/"));
|
||||
if (!uri.startsWith("msp")) {
|
||||
requestTemplate.uri("/openapi/v1/" + omadaProperties.getOmadacId() + lastUri);
|
||||
}
|
||||
|
||||
// 添加授权请求头
|
||||
requestTemplate.header(AUTHORIZATION, authorization);
|
||||
}
|
||||
@@ -103,8 +112,7 @@ public class FeignConfig implements RequestInterceptor {
|
||||
ResponseEntity<OmadaResult<AuthorizeTokenVO>> responseEntity = restTemplate.exchange(uriString, HttpMethod.POST,
|
||||
request, new ParameterizedTypeReference<OmadaResult<AuthorizeTokenVO>>() {
|
||||
});
|
||||
OmadaResult<AuthorizeTokenVO> omadaResult = responseEntity.getBody();
|
||||
return omadaResult;
|
||||
return responseEntity.getBody();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user