From f89232c2dd439f9ae9a06e3ab158c96396268c2f Mon Sep 17 00:00:00 2001 From: boyce <6549168@qq.com> Date: Thu, 12 Mar 2026 16:54:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=93=9D=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/blueprint/blueprint.go | 1 + util/blueprint/sysnodes.go | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/util/blueprint/blueprint.go b/util/blueprint/blueprint.go index 9770098..59257c5 100644 --- a/util/blueprint/blueprint.go +++ b/util/blueprint/blueprint.go @@ -71,6 +71,7 @@ func (bm *Blueprint) regSysNodes() { bm.RegisterExecNode(NewExecNode[CreateTimer]()) bm.RegisterExecNode(NewExecNode[AppendIntReturn]()) bm.RegisterExecNode(NewExecNode[AppendStringReturn]()) + bm.RegisterExecNode(NewExecNode[IntInArray]()) } diff --git a/util/blueprint/sysnodes.go b/util/blueprint/sysnodes.go index 4381dee..add71c8 100644 --- a/util/blueprint/sysnodes.go +++ b/util/blueprint/sysnodes.go @@ -780,5 +780,37 @@ func (em *AppendStringReturn) Exec() (int, error) { } returnPort.AppendArrayValStr(val) + return -0, nil +} + +// IntInArray 判断整型值是否在整型数组中 +type IntInArray struct { + BaseExecNode +} + +func (em *IntInArray) GetName() string { + return "IntInArray" +} + +func (em *IntInArray) Exec() (int, error) { + val, ok := em.GetInPortInt(1) + if !ok { + return -1, fmt.Errorf("IntInArray inParam 1 not found") + } + + array, ok := em.GetInPortArray(2) + if !ok { + return -1, fmt.Errorf("IntInArray inParam 0 not found") + } + + bFind := false + for i := range array { + if array[i].IntVal == val { + bFind = true + break + } + } + + em.SetOutPortBool(1,bFind) return -0, nil } \ No newline at end of file