From 46914b3eb0927dfa12d1ab6fefabe54086009dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Mon, 18 Jan 2021 12:35:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BE=85=E5=8D=87=E7=BA=A7?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E7=89=88=E6=9C=AC=E5=8F=B7=E5=AF=B9=E6=AF=94?= =?UTF-8?q?=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/db/models/node_dao.go | 11 +++++---- internal/nodes/node_status_executor.go | 2 ++ internal/utils/ip.go | 19 ++++++++++++++++ internal/utils/version.go | 18 +++++++++++++++ internal/utils/version_test.go | 31 ++++++++++++++++++++++++++ 5 files changed, 77 insertions(+), 4 deletions(-) create mode 100644 internal/utils/ip.go create mode 100644 internal/utils/version.go create mode 100644 internal/utils/version_test.go diff --git a/internal/db/models/node_dao.go b/internal/db/models/node_dao.go index ef2e2f8b..b25e416f 100644 --- a/internal/db/models/node_dao.go +++ b/internal/db/models/node_dao.go @@ -3,6 +3,7 @@ package models import ( "encoding/json" "github.com/TeaOSLab/EdgeAPI/internal/errors" + "github.com/TeaOSLab/EdgeAPI/internal/utils" "github.com/TeaOSLab/EdgeAPI/internal/utils/numberutils" "github.com/TeaOSLab/EdgeCommon/pkg/configutils" "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" @@ -10,6 +11,7 @@ import ( _ "github.com/go-sql-driver/mysql" "github.com/iwind/TeaGo/Tea" "github.com/iwind/TeaGo/dbs" + "github.com/iwind/TeaGo/logs" "github.com/iwind/TeaGo/maps" "github.com/iwind/TeaGo/rands" "github.com/iwind/TeaGo/types" @@ -603,10 +605,10 @@ func (this *NodeDAO) CountAllLowerVersionNodesWithClusterId(tx *dbs.Tx, clusterI Where("status IS NOT NULL"). Where("JSON_EXTRACT(status, '$.os')=:os"). Where("JSON_EXTRACT(status, '$.arch')=:arch"). - Where("INET_ATON(JSON_UNQUOTE(JSON_EXTRACT(status, '$.buildVersion')))