diff --git a/cmd/iom.go b/cmd/iom.go index 9218ce5..61cadb6 100644 --- a/cmd/iom.go +++ b/cmd/iom.go @@ -258,7 +258,11 @@ func runIOM() { if err != nil || resp.IsError() { panic(exception.New("获取设备详情失败")) } - nodeID := gjson.Get(resp.String(), "0.eqptNodeId").Int() + var nodeIDs []int64 + gjson.Parse(resp.String()).ForEach(func(key, value gjson.Result) bool { + nodeIDs = append(nodeIDs, value.Get("eqptNodeId").Int()) + return true // 返回true以继续遍历 + }) //取消关联 resp, err = client.R(). SetHeaders(map[string]string{ @@ -268,7 +272,7 @@ func runIOM() { "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36", }). SetBody(map[string]interface{}{ - "eqptNodeIds": []int64{nodeID}, + "eqptNodeIds": nodeIDs, "standardAddrId": gjson.Get(shi.String(), "standardAddrId").String(), "oldAddrId": gjson.Get(shi.String(), "standardAddrId").String(), "regionId": "A",