feat: agents sort by id desc
This commit is contained in:
parent
0698ae44dc
commit
acb85944e8
@ -16,6 +16,8 @@ package agent
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"sort"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/go-resty/resty/v2"
|
"github.com/go-resty/resty/v2"
|
||||||
@ -57,6 +59,11 @@ func (a *agentsClient) Get(ids []string) ([]Agent, error) {
|
|||||||
|
|
||||||
req := a.c.R()
|
req := a.c.R()
|
||||||
|
|
||||||
|
sort.Slice(ids, func(i, j int) bool {
|
||||||
|
x, _ := strconv.Atoi(ids[i])
|
||||||
|
y, _ := strconv.Atoi(ids[j])
|
||||||
|
return x > y
|
||||||
|
})
|
||||||
idQuery := strings.Join(ids, ",")
|
idQuery := strings.Join(ids, ",")
|
||||||
|
|
||||||
req.QueryParam.Add("id", idQuery)
|
req.QueryParam.Add("id", idQuery)
|
||||||
|
Loading…
Reference in New Issue
Block a user