Commit 73fa4c88 by yanHeng

[修改] 轨迹获取token

parent b83bdf00
......@@ -92,6 +92,8 @@ public class IotPlatformUtils {
HashMap<String, Object> tokenMap = getAuthToken(CLIET_ID, CLIENT_SECRET);
if ((int) tokenMap.get("status") == 0) {
token = tokenMap.get("data").toString();
}else {
return null;
}
}
List<Map<String,Object>> imeisInfos = new ArrayList<>();
......@@ -175,6 +177,11 @@ public class IotPlatformUtils {
String sendPost = HttpSendUtil.sendPost(TOKEN_URL, sendParam, StandardCharsets.UTF_8.name());
JSONObject postStr = new JSONObject(sendPost);
if(40000 == postStr.getInt("code")){
map.put("status", -2);
map.put("message", "获取IOT平台token失败");
return map;
}
String accessToken = postStr.getString("access_token");
if (accessToken != null) {
RedisUtils.getInstance().set(getGpsWuLingTokenRedisKey(CLIET_ID, CLIENT_SECRET),accessToken,postStr.getInt("expires_in")-3);
......@@ -207,6 +214,8 @@ public class IotPlatformUtils {
HashMap<String, Object> tokenMap = getAuthToken(CLIET_ID, CLIENT_SECRET);
if ((int) tokenMap.get("status") == 0) {
token = tokenMap.get("data").toString();
}else {
return null;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment