From 5a206cb5184875faf9fcb3c7092335f6a1d514fb Mon Sep 17 00:00:00 2001 From: GoEdgeLab Date: Sun, 18 Sep 2022 12:39:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/db/models/node_dao.go | 15 +++------------ internal/db/models/node_dao_limit.go | 12 ++++++++++++ 2 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 internal/db/models/node_dao_limit.go diff --git a/internal/db/models/node_dao.go b/internal/db/models/node_dao.go index 0e02dd6f..a09d9bcf 100644 --- a/internal/db/models/node_dao.go +++ b/internal/db/models/node_dao.go @@ -140,18 +140,9 @@ func (this *NodeDAO) FindNodeName(tx *dbs.Tx, id int64) (string, error) { // CreateNode 创建节点 func (this *NodeDAO) CreateNode(tx *dbs.Tx, adminId int64, name string, clusterId int64, groupId int64, regionId int64) (nodeId int64, err error) { - // 检查节点数量 - if teaconst.MaxNodes > 0 { - count, err := this.Query(tx). - State(NodeStateEnabled). - Where("clusterId IN (SELECT id FROM " + SharedNodeClusterDAO.Table + " WHERE state=1)"). - Count() - if err != nil { - return 0, err - } - if int64(teaconst.MaxNodes) <= count { - return 0, errors.New("[企业版]超出最大节点数限制:" + types.String(teaconst.MaxNodes) + ",请购买更多配额") - } + err = this.CheckNodesLimit(tx) + if err != nil { + return } uniqueId, err := this.GenUniqueId(tx) diff --git a/internal/db/models/node_dao_limit.go b/internal/db/models/node_dao_limit.go new file mode 100644 index 00000000..7b640c99 --- /dev/null +++ b/internal/db/models/node_dao_limit.go @@ -0,0 +1,12 @@ +// Copyright 2022 Liuxiangchao iwind.liu@gmail.com. All rights reserved. Official site: https://goedge.cn . +//go:build !plus + +package models + +import ( + "github.com/iwind/TeaGo/dbs" +) + +func (this *NodeDAO) CheckNodesLimit(tx *dbs.Tx) error { + return nil +}