优化执行结点

This commit is contained in:
boyce
2025-10-05 14:56:37 +08:00
parent 654426a836
commit 640b61bcdb
3 changed files with 11 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ func TestExecMgr(t *testing.T) {
}
graphTest1 := bp.Create("testSwitch")
err = graphTest1.Do(EntranceID_IntParam, 2, 1, 3)
err = graphTest1.Do(EntranceID_IntParam, 20, 1, 3)
if err != nil {
t.Fatalf("Do EntranceID_IntParam failed,err:%v", err)
}

View File

@@ -54,7 +54,14 @@ func (en *execNode) GetInPortDefaultIntArrayValue(index int) []int64 {
return nil
}
return val.([]int64)
var arrayInt []int64
arrayVal := val.([]any)
for i := range arrayVal {
if intVal, ok := arrayVal[i].(float64); ok {
arrayInt = append(arrayInt, int64(intVal))
}
}
return arrayInt
}
func (en *execNode) GetInPortDefaultStringArrayValue(index int) []string {

View File

@@ -408,7 +408,6 @@ func (em *RangeCompare) GetName() string {
}
func (em *RangeCompare) Exec() (int, error) {
inPortA := em.GetInPort(1)
if inPortA == nil {
return -1, fmt.Errorf("GreaterThanInteger inParam 1 not found")
@@ -424,8 +423,8 @@ func (em *RangeCompare) Exec() (int, error) {
return 0, nil
}
for i := range intArray {
if intArray[i] <= ret {
for i := 0; i < len(intArray) && i < em.GetOutPortCount()-2; i++ {
if ret <= intArray[i] {
return i + 2, nil
}
}