Merge branch 'refs/heads/fix_n9e_err'

This commit is contained in:
2025-09-10 19:33:25 +08:00

View File

@@ -42,12 +42,17 @@ public class N9eSyncTask {
requestBody.put("queries", queries);
// 发送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("Content-Type", "application/json")
.body(JacksonUtil.toJSONString(requestBody))
.execute();
Map<String, Object> respData = JacksonUtil.parseObject(response.body(), Map.class);
.execute()) {
respData = JacksonUtil.parseObject(response.body(), Map.class);
} catch (Exception e) {
log.warn("N9E信息获取失败");
return;
}
String err = (String) respData.get("err");
if (StringUtils.isNotBlank(err)) {
log.warn("N9E信息获取失败");
@@ -65,8 +70,8 @@ public class N9eSyncTask {
list.forEach(item -> {
String ident = (String) item.get("ident");
Number updateAtNum = (Number) item.get("update_at");
Long updateAt = updateAtNum != null ? updateAtNum.longValue() : 0L;
redisTemplate.opsForValue().set("ext_device:online:" + ident, updateAt.toString(), 1, TimeUnit.DAYS);
long updateAt = updateAtNum != null ? updateAtNum.longValue() : 0L;
redisTemplate.opsForValue().set("ext_device:online:" + ident, Long.toString(updateAt), 1, TimeUnit.DAYS);
});
}
}