diff --git a/pom.xml b/pom.xml index b1f0fed..f1e4cc7 100644 --- a/pom.xml +++ b/pom.xml @@ -102,7 +102,8 @@ com.alibaba fastjson - 1.2.51 + + 2.0.3 diff --git a/src/main/java/com/example/modular/lecheng/util/SdkClient.java b/src/main/java/com/example/modular/lecheng/util/SdkClient.java index 01052af..8d73053 100644 --- a/src/main/java/com/example/modular/lecheng/util/SdkClient.java +++ b/src/main/java/com/example/modular/lecheng/util/SdkClient.java @@ -169,9 +169,9 @@ public class SdkClient { if (result != null) { String code = result.getString("code"); if (CODE_SUCCESS.equals(code)) { - int expireTime = Integer.parseInt(JSONPath.read(response, "$.result.data.expireTime")+""); - ACCESS_TOKEN = (String) JSONPath.read(response, "$.result.data.accessToken"); - ACCESS_TOKEN_EXPIRE = System.currentTimeMillis() + expireTime*1000; +// int expireTime = Integer.parseInt(JSONPath.read(response, "$.result.data.expireTime")+""); +// ACCESS_TOKEN = (String) JSONPath.read(response, "$.result.data.accessToken"); +// ACCESS_TOKEN_EXPIRE = System.currentTimeMillis() + expireTime*1000; } else { System.err.printf("[IMOU-SDK]获取accessToken失败:%s | %s", code, result.getString("msg")); } @@ -249,11 +249,9 @@ public class SdkClient { if (result != null) { String code = result.getString("code"); if (CODE_SUCCESS.equals(code)) { - int expireTime = Integer.parseInt(JSONPath.read(response, "$.result.data.expireTime")+""); -// if (expireTime > 1) { -// expireTime--; -// } - kitToken = (String) JSONPath.read(response, "$.result.data.kitToken"); +// int expireTime = Integer.parseInt(JSONPath.read(response, "$.result.data.expireTime")+""); +// kitToken = (String) JSONPath.read(response, "$.result.data.kitToken"); + kitToken = (String) JSONPath.extract(response, "$.result.data.kitToken"); // sdkClient.redisUtil.set(Constant.LECHENG_KIT_TOKEN,kitToken,expireTime); // KIT_TOKEN.put(kitTokenKey(deviceId, channelId), // new Token(kitToken,System.currentTimeMillis() + expireTime*1000)