🧑‍💻 Add a parameter containChildren for the kernel API /api/ref/getBacklinkDoc

接口 `/api/ref/getBacklinkDoc` 和 `/api/ref/getBackmentionDoc`  添加参数 `containChildren` 。

Co-authored-by: weizelong <1710010123@qq.com>
This commit is contained in:
Misuzu2027
2024-08-21 12:26:51 +08:00
committed by GitHub
parent 380cee6e10
commit 13140edd6b
4 changed files with 18 additions and 8 deletions

View File

@@ -51,7 +51,11 @@ func getBackmentionDoc(c *gin.Context) {
defID := arg["defID"].(string)
refTreeID := arg["refTreeID"].(string)
keyword := arg["keyword"].(string)
backlinks := model.GetBackmentionDoc(defID, refTreeID, keyword)
containChildren := true
if val, ok := arg["containChildren"]; ok {
containChildren = val.(bool)
}
backlinks := model.GetBackmentionDoc(defID, refTreeID, keyword, containChildren)
ret.Data = map[string]interface{}{
"backmentions": backlinks,
}
@@ -69,7 +73,11 @@ func getBacklinkDoc(c *gin.Context) {
defID := arg["defID"].(string)
refTreeID := arg["refTreeID"].(string)
keyword := arg["keyword"].(string)
backlinks := model.GetBacklinkDoc(defID, refTreeID, keyword)
containChildren := true
if val, ok := arg["containChildren"]; ok {
containChildren = val.(bool)
}
backlinks := model.GetBacklinkDoc(defID, refTreeID, keyword, containChildren)
ret.Data = map[string]interface{}{
"backlinks": backlinks,
}