|
@@ -7,6 +7,8 @@ import org.springframework.stereotype.Component;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
import thyyxxk.webserver.utils.TokenUtil;
|
|
|
|
|
|
+import java.net.InetAddress;
|
|
|
+
|
|
|
@Slf4j
|
|
|
@Component
|
|
|
public class FetchAccessTokenTask {
|
|
@@ -23,6 +25,15 @@ public class FetchAccessTokenTask {
|
|
|
|
|
|
@Scheduled(fixedRate = 6900 * 1000)
|
|
|
public void getAccessToken() {
|
|
|
+ try {
|
|
|
+ InetAddress addr = InetAddress.getLocalHost();
|
|
|
+ String address=addr.getHostName();
|
|
|
+ if ("THYYXXK-DJ".equals(address)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
String httpRes = restTemplate.getForObject(USERINFO_ACCESS_TOKEN_URL, String.class);
|
|
|
JSONObject json = JSONObject.parseObject(httpRes);
|