From 92a3b8f3753fc28e94d76509af8ec3807d4a2ff2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Wed, 15 Sep 2021 10:44:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=81=A5=E5=BA=B7=E6=A3=80=E6=9F=A5=E5=8F=AA?= =?UTF-8?q?=E6=A3=80=E6=9F=A5=E5=90=AF=E7=94=A8=E7=9A=84IP=E5=9C=B0?= =?UTF-8?q?=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/db/models/node_ip_address_dao.go | 4 ++++ internal/db/models/node_ip_address_log_dao_test.go | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/internal/db/models/node_ip_address_dao.go b/internal/db/models/node_ip_address_dao.go index 33a17b61..07d661bb 100644 --- a/internal/db/models/node_ip_address_dao.go +++ b/internal/db/models/node_ip_address_dao.go @@ -223,6 +223,8 @@ func (this *NodeIPAddressDAO) FindFirstNodeAccessIPAddress(tx *dbs.Tx, nodeId in Attr("role", role). State(NodeIPAddressStateEnabled). Attr("canAccess", true). + Attr("isOn", true). + Attr("isUp", true). Desc("order"). AscPk(). Result("ip"). @@ -239,6 +241,8 @@ func (this *NodeIPAddressDAO) FindFirstNodeAccessIPAddressId(tx *dbs.Tx, nodeId Attr("role", role). State(NodeIPAddressStateEnabled). Attr("canAccess", true). + Attr("isOn", true). + Attr("isUp", true). Desc("order"). AscPk(). Result("id"). diff --git a/internal/db/models/node_ip_address_log_dao_test.go b/internal/db/models/node_ip_address_log_dao_test.go index 224e9db7..1aaf1460 100644 --- a/internal/db/models/node_ip_address_log_dao_test.go +++ b/internal/db/models/node_ip_address_log_dao_test.go @@ -1,6 +1,14 @@ package models import ( + "github.com/TeaOSLab/EdgeCommon/pkg/nodeconfigs" _ "github.com/go-sql-driver/mysql" _ "github.com/iwind/TeaGo/bootstrap" + "testing" ) + +func TestNodeIPAddressDAO_FindFirstNodeAccessIPAddress(t *testing.T) { + var dao = NewNodeIPAddressDAO() + t.Log(dao.FindFirstNodeAccessIPAddress(nil, 48, nodeconfigs.NodeRoleNode)) + t.Log(dao.FindFirstNodeAccessIPAddressId(nil, 48, nodeconfigs.NodeRoleNode)) +} \ No newline at end of file