Browse Source

升级fastjson版本至2。0.3版本

master
yingsl 3 years ago
parent
commit
7eae8e1c7c
  1. 3
      pom.xml
  2. 14
      src/main/java/com/example/modular/lecheng/util/SdkClient.java

3
pom.xml

@ -102,7 +102,8 @@
<dependency> <dependency>
<groupId>com.alibaba</groupId> <groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
<version>1.2.51</version>
<!-- <version>1.2.51</version>-->
<version>2.0.3</version>
</dependency> </dependency>

14
src/main/java/com/example/modular/lecheng/util/SdkClient.java

@ -169,9 +169,9 @@ public class SdkClient {
if (result != null) { if (result != null) {
String code = result.getString("code"); String code = result.getString("code");
if (CODE_SUCCESS.equals(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 { } else {
System.err.printf("[IMOU-SDK]获取accessToken失败:%s | %s", code, result.getString("msg")); System.err.printf("[IMOU-SDK]获取accessToken失败:%s | %s", code, result.getString("msg"));
} }
@ -249,11 +249,9 @@ public class SdkClient {
if (result != null) { if (result != null) {
String code = result.getString("code"); String code = result.getString("code");
if (CODE_SUCCESS.equals(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); // sdkClient.redisUtil.set(Constant.LECHENG_KIT_TOKEN,kitToken,expireTime);
// KIT_TOKEN.put(kitTokenKey(deviceId, channelId), // KIT_TOKEN.put(kitTokenKey(deviceId, channelId),
// new Token(kitToken,System.currentTimeMillis() + expireTime*1000) // new Token(kitToken,System.currentTimeMillis() + expireTime*1000)

Loading…
Cancel
Save