From 70389b644d157b3b038aae69ac6230d61ee680f3 Mon Sep 17 00:00:00 2001 From: boyce <6549168@qq.com> Date: Wed, 22 Oct 2025 16:13:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BB=93=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/blueprint/sysnodes.go | 39 +++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/util/blueprint/sysnodes.go b/util/blueprint/sysnodes.go index 764fc50..c5cd426 100644 --- a/util/blueprint/sysnodes.go +++ b/util/blueprint/sysnodes.go @@ -2,9 +2,10 @@ package blueprint import ( "fmt" - "github.com/duanhf2012/origin/v2/log" "math/rand/v2" "time" + + "github.com/duanhf2012/origin/v2/log" ) // 系统入口ID定义,1000以内 @@ -21,6 +22,8 @@ func init() { RegExecNode(&Output{}) RegExecNode(&Sequence{}) RegExecNode(&Foreach{}) + RegExecNode(&ForeachIntArray{}) + RegExecNode(&GetArrayInt{}) RegExecNode(&GetArrayString{}) RegExecNode(&GetArrayLen{}) @@ -125,6 +128,36 @@ func (em *Sequence) Exec() (int, error) { return -1, nil } +type ForeachIntArray struct { + BaseExecNode +} + +func (em *ForeachIntArray) GetName() string { + return "ForeachIntArray" +} + +func (em *ForeachIntArray) Exec() (int, error) { + array, ok := em.GetInPortArray(1) + if !ok { + return 0, fmt.Errorf("ForeachIntArray Exec inParam 1 not found") + } + + for i := range array { + em.ExecContext.OutputPorts[2].SetInt(array[i].IntVal) + err := em.DoNext(0) + if err != nil { + return -1, err + } + } + + err := em.DoNext(1) + if err != nil { + return -1, err + } + + return -1, nil +} + type Foreach struct { BaseExecNode } @@ -649,8 +682,8 @@ func (em *CreateTimer) Exec() (int, error) { if err != nil { log.Warnf("CreateTimer SafeAfterFunc error timerId:%d err:%v", timerId, err) } - - em.gr.IBlueprintModule.CancelTimerId(graphID,&timerId) + + em.gr.IBlueprintModule.CancelTimerId(graphID, &timerId) }) em.gr.mapTimerID[timerId] = struct{}{}