From dc7c0885a71af1130c5cdcb9cc0555cff0124387 Mon Sep 17 00:00:00 2001 From: 710leo <710leo@gmail.com> Date: Fri, 4 Dec 2020 21:27:14 +0800 Subject: [PATCH] feat: support get nodes by ids --- src/modules/rdb/http/router_node.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/modules/rdb/http/router_node.go b/src/modules/rdb/http/router_node.go index 5a2f50c0..df366c14 100644 --- a/src/modules/rdb/http/router_node.go +++ b/src/modules/rdb/http/router_node.go @@ -18,6 +18,7 @@ func nodeGet(c *gin.Context) { func nodeGets(c *gin.Context) { cate := queryStr(c, "cate", "") withInner := queryInt(c, "inner", 0) + ids := queryStr(c, "ids", "") where := "" param := []interface{}{} @@ -34,6 +35,13 @@ func nodeGets(c *gin.Context) { param = append(param, "inner") } + if ids != "" { + if where != "" { + where += " and " + } + where += "id in (" + ids + ")" + } + nodes, err := models.NodeGets(where, param...) for i := 0; i < len(nodes); i++ { nodes[i].FillAdmins()