diff --git a/kernel/model/path.go b/kernel/model/path.go index be9678ea6..0c25d6d73 100644 --- a/kernel/model/path.go +++ b/kernel/model/path.go @@ -52,9 +52,9 @@ func createDocsByHPath(boxID, hPath, content, parentID, id string /* id 参数 return } } else { + retID = ast.NewNodeID() if "" == id { - id = ast.NewNodeID() - retID = id + id = retID } } @@ -95,10 +95,12 @@ func createDocsByHPath(boxID, hPath, content, parentID, id string /* id 参数 root = hpathBtMap[hp] isNotLast := i < len(parts)-1 if nil == root { - if "" == retID { - retID = ast.NewNodeID() + rootID := ast.NewNodeID() + if i == len(parts)-1 { + rootID = retID } - pathBuilder.WriteString(retID) + + pathBuilder.WriteString(rootID) docP := pathBuilder.String() + ".sy" if isNotLast { if _, err = createDoc(boxID, docP, part, ""); nil != err { @@ -118,9 +120,6 @@ func createDocsByHPath(boxID, hPath, content, parentID, id string /* id 参数 } } } else { - if "" == retID { - retID = root.ID - } pathBuilder.WriteString(root.ID) if !isNotLast { pathBuilder.WriteString(".sy")