|
@ -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) |
|
|