计算区域监控终端低版本数量时忽略已禁用的终端

This commit is contained in:
GoEdgeLab
2022-09-08 10:14:02 +08:00
parent d9b49b55fa
commit faf70d6770

View File

@@ -320,6 +320,7 @@ func (this *ReportNodeDAO) FindNodeAllowIPs(tx *dbs.Tx, nodeId int64) ([]string,
func (this *ReportNodeDAO) CountAllLowerVersionNodes(tx *dbs.Tx, version string) (int64, error) { func (this *ReportNodeDAO) CountAllLowerVersionNodes(tx *dbs.Tx, version string) (int64, error) {
return this.Query(tx). return this.Query(tx).
State(ReportNodeStateEnabled). State(ReportNodeStateEnabled).
Attr("isOn", true).
Where("status IS NOT NULL"). Where("status IS NOT NULL").
Where("(JSON_EXTRACT(status, '$.buildVersionCode') IS NULL OR JSON_EXTRACT(status, '$.buildVersionCode')<:version)"). Where("(JSON_EXTRACT(status, '$.buildVersionCode') IS NULL OR JSON_EXTRACT(status, '$.buildVersionCode')<:version)").
Param("version", utils.VersionToLong(version)). Param("version", utils.VersionToLong(version)).