diff --git a/internal/db/models/node_dao.go b/internal/db/models/node_dao.go index e95cd91e..b1971911 100644 --- a/internal/db/models/node_dao.go +++ b/internal/db/models/node_dao.go @@ -432,9 +432,9 @@ func (this *NodeDAO) FindAllInactiveNodesWithClusterId(tx *dbs.Tx, clusterId int _, err = this.Query(tx). State(NodeStateEnabled). Attr("clusterId", clusterId). - Attr("isOn", true). // 只监控启用的节点 + Attr("isOn", true). // 只监控启用的节点 Attr("isInstalled", true). // 只监控已经安装的节点 - Attr("isActive", true). // 当前已经在线的 + Attr("isActive", true). // 当前已经在线的 Where("(status IS NULL OR (JSON_EXTRACT(status, '$.isActive')=false AND UNIX_TIMESTAMP()-JSON_EXTRACT(status, '$.updatedAt')>10) OR UNIX_TIMESTAMP()-JSON_EXTRACT(status, '$.updatedAt')>120)"). Result("id", "name"). Slice(&result). @@ -941,6 +941,7 @@ func (this *NodeDAO) CountAllEnabledNodesWithGroupId(tx *dbs.Tx, groupId int64) return this.Query(tx). State(NodeStateEnabled). Attr("groupId", groupId). + Where("clusterId IN (SELECT id FROM " + SharedNodeClusterDAO.Table + " WHERE state=1)"). Count() }