diff --git a/server/utility/tree/tree_list.go b/server/utility/tree/tree_list.go index 3e71a9e..17c5ab2 100644 --- a/server/utility/tree/tree_list.go +++ b/server/utility/tree/tree_list.go @@ -13,6 +13,9 @@ type Node interface { // ListToTree 根据上下级关系将列表数据转为树状数据 func ListToTree(pid int64, nodes []Node) (list []Node, err error) { + if len(nodes) == 0 { + return nodes, nil + } for _, v := range nodes { if v.PID() == pid { item := v