Nodename search (#484)

* node name search

* node name search

* node name search

* node name search

Co-authored-by: alickliming <alickliming@didi.global.com>
This commit is contained in:
alick-liming 2021-01-05 14:31:18 +08:00 committed by GitHub
parent e82f560c44
commit a8008a9418
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

View File

@ -80,6 +80,15 @@ func treeUntilLeafGets(c *gin.Context) {
if strings.Contains(ret[i].Path, arr[0]) {
pathSet[ret[i].Path] = struct{}{}
}
// 根据节点名搜索
if strings.Contains(ret[i].Name, arr[0]) {
for j := 0; j < cnt; j++ {
if strings.HasPrefix(ret[j].Path, ret[i].Path) {
pathSet[ret[j].Path] = struct{}{}
}
}
}
}
}
} else {
@ -90,6 +99,15 @@ func treeUntilLeafGets(c *gin.Context) {
if !strings.Contains(ret[i].Path, arr[j]) {
match = false
}
// 根据节点名搜索
if strings.Contains(ret[i].Name, arr[j]) {
for k := 0; k < cnt; k++ {
if strings.HasPrefix(ret[k].Path, ret[i].Path) {
pathSet[ret[k].Path] = struct{}{}
}
}
}
}
if match {