You've already forked FrameTour-BE
Merge branch 'refs/heads/fix_n9e_err'
This commit is contained in:
@@ -42,12 +42,17 @@ public class N9eSyncTask {
|
|||||||
requestBody.put("queries", queries);
|
requestBody.put("queries", queries);
|
||||||
|
|
||||||
// 发送POST请求
|
// 发送POST请求
|
||||||
HttpResponse response = HttpUtil.createPost("https://n9e.jerryyan.top/v1/n9e/target/list")
|
Map<String, Object> respData;
|
||||||
|
try (HttpResponse response = HttpUtil.createPost("https://n9e.jerryyan.top/v1/n9e/target/list")
|
||||||
.header("Authorization", auth)
|
.header("Authorization", auth)
|
||||||
.header("Content-Type", "application/json")
|
.header("Content-Type", "application/json")
|
||||||
.body(JacksonUtil.toJSONString(requestBody))
|
.body(JacksonUtil.toJSONString(requestBody))
|
||||||
.execute();
|
.execute()) {
|
||||||
Map<String, Object> respData = JacksonUtil.parseObject(response.body(), Map.class);
|
respData = JacksonUtil.parseObject(response.body(), Map.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.warn("N9E信息获取失败");
|
||||||
|
return;
|
||||||
|
}
|
||||||
String err = (String) respData.get("err");
|
String err = (String) respData.get("err");
|
||||||
if (StringUtils.isNotBlank(err)) {
|
if (StringUtils.isNotBlank(err)) {
|
||||||
log.warn("N9E信息获取失败");
|
log.warn("N9E信息获取失败");
|
||||||
@@ -65,8 +70,8 @@ public class N9eSyncTask {
|
|||||||
list.forEach(item -> {
|
list.forEach(item -> {
|
||||||
String ident = (String) item.get("ident");
|
String ident = (String) item.get("ident");
|
||||||
Number updateAtNum = (Number) item.get("update_at");
|
Number updateAtNum = (Number) item.get("update_at");
|
||||||
Long updateAt = updateAtNum != null ? updateAtNum.longValue() : 0L;
|
long updateAt = updateAtNum != null ? updateAtNum.longValue() : 0L;
|
||||||
redisTemplate.opsForValue().set("ext_device:online:" + ident, updateAt.toString(), 1, TimeUnit.DAYS);
|
redisTemplate.opsForValue().set("ext_device:online:" + ident, Long.toString(updateAt), 1, TimeUnit.DAYS);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user