feat: support get nodes by ids
This commit is contained in:
parent
82a42f3649
commit
dc7c0885a7
|
@ -18,6 +18,7 @@ func nodeGet(c *gin.Context) {
|
||||||
func nodeGets(c *gin.Context) {
|
func nodeGets(c *gin.Context) {
|
||||||
cate := queryStr(c, "cate", "")
|
cate := queryStr(c, "cate", "")
|
||||||
withInner := queryInt(c, "inner", 0)
|
withInner := queryInt(c, "inner", 0)
|
||||||
|
ids := queryStr(c, "ids", "")
|
||||||
|
|
||||||
where := ""
|
where := ""
|
||||||
param := []interface{}{}
|
param := []interface{}{}
|
||||||
|
@ -34,6 +35,13 @@ func nodeGets(c *gin.Context) {
|
||||||
param = append(param, "inner")
|
param = append(param, "inner")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ids != "" {
|
||||||
|
if where != "" {
|
||||||
|
where += " and "
|
||||||
|
}
|
||||||
|
where += "id in (" + ids + ")"
|
||||||
|
}
|
||||||
|
|
||||||
nodes, err := models.NodeGets(where, param...)
|
nodes, err := models.NodeGets(where, param...)
|
||||||
for i := 0; i < len(nodes); i++ {
|
for i := 0; i < len(nodes); i++ {
|
||||||
nodes[i].FillAdmins()
|
nodes[i].FillAdmins()
|
||||||
|
|
Loading…
Reference in New Issue