From c4a4523cdfa17c37fb1f982ea403e7ccdf3db76a Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Sun, 2 Oct 2022 12:36:53 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E7=BC=96=E8=BE=91=E5=99=A8?= =?UTF-8?q?=E5=BC=8F=E5=8F=8D=E9=93=BE=E9=9D=A2=E6=9D=BF=20https://github.?= =?UTF-8?q?com/siyuan-note/siyuan/issues/3565?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/api/ref.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/kernel/api/ref.go b/kernel/api/ref.go index d3ec6271e..682b76fa8 100644 --- a/kernel/api/ref.go +++ b/kernel/api/ref.go @@ -73,7 +73,6 @@ func getBacklinkDoc(c *gin.Context) { } } - func getBacklink2(c *gin.Context) { ret := gulu.Ret.NewResult() defer c.JSON(http.StatusOK, ret) @@ -118,8 +117,11 @@ func getBacklink(c *gin.Context) { id := arg["id"].(string) keyword := arg["k"].(string) mentionKeyword := arg["mk"].(string) - beforeLen := arg["beforeLen"].(float64) - boxID, backlinks, backmentions, linkRefsCount, mentionsCount := model.GetBacklink(id, keyword, mentionKeyword, int(beforeLen)) + beforeLen := 12 + if nil != arg["beforeLen"] { + beforeLen = int(arg["beforeLen"].(float64)) + } + boxID, backlinks, backmentions, linkRefsCount, mentionsCount := model.GetBacklink(id, keyword, mentionKeyword, beforeLen) ret.Data = map[string]interface{}{ "backlinks": backlinks, "linkRefsCount": linkRefsCount,