|
@@ -120,12 +120,12 @@ public class DhServiceImpl implements IDhService {
|
|
|
public void tokenKeepalive(String token) {
|
|
|
JSONObject json = new JSONObject();
|
|
|
json.set("token", token);
|
|
|
- json.set("duration", 120);
|
|
|
+ json.set("duration", 86400);
|
|
|
String put = HttpRequest.put(keepaliveUrl).timeout(-1).body(json.toString()).execute().body();
|
|
|
JSONObject putJson = JSONUtil.parseObj(put);
|
|
|
if (putJson.getInt("code") == 200) {
|
|
|
// 存入redis缓存
|
|
|
- RedisUtils.setCacheObject(Constants.CACHE_DH_TOKEN, token, 120, TimeUnit.SECONDS);
|
|
|
+ RedisUtils.setCacheObject(Constants.CACHE_DH_TOKEN, token, 86400, TimeUnit.SECONDS);
|
|
|
} else {
|
|
|
log.info("保活失败:{}。重新获取", putJson);
|
|
|
authorize();
|
|
@@ -205,6 +205,9 @@ public class DhServiceImpl implements IDhService {
|
|
|
if (getJson.containsKey("code")) {
|
|
|
// 说明有错误
|
|
|
log.error("获取设备树出错:{}", getJson);
|
|
|
+ if (401 == getJson.getInt("code")) {
|
|
|
+ RedisUtils.deleteObject(Constants.CACHE_DH_TOKEN);
|
|
|
+ }
|
|
|
throw new ServiceException("调用大华融合通信平台接口创建会话出错,错误:" + getJson.getStr("message"));
|
|
|
}
|
|
|
return getJson.getJSONArray("results");
|