From 7eae8e1c7c008be750a17afc7e28154d1f4934ce Mon Sep 17 00:00:00 2001 From: yingsl Date: Tue, 24 May 2022 10:34:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7fastjson=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E8=87=B32=E3=80=820.3=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 3 ++- .../java/com/example/modular/lecheng/util/SdkClient.java | 14 ++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) 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)