Browse Source

:art: 反链面板支持文档排序 https://github.com/siyuan-note/insider/issues/1086

Liang Ding 2 years ago
parent
commit
8b5f2cad5a
1 changed files with 3 additions and 2 deletions
  1. 3 2
      kernel/api/ref.go

+ 3 - 2
kernel/api/ref.go

@@ -18,6 +18,7 @@ package api
 
 import (
 	"net/http"
+	"strconv"
 
 	"github.com/88250/gulu"
 	"github.com/gin-gonic/gin"
@@ -92,12 +93,12 @@ func getBacklink2(c *gin.Context) {
 	sortArg := arg["sort"]
 	sort := util.SortModeUpdatedDESC
 	if nil != sortArg {
-		sort = int(sortArg.(float64))
+		sort, _ = strconv.Atoi(sortArg.(string))
 	}
 	mentionSortArg := arg["msort"]
 	mentionSort := util.SortModeUpdatedDESC
 	if nil != mentionSortArg {
-		sort = int(mentionSortArg.(float64))
+		mentionSort, _ = strconv.Atoi(mentionSortArg.(string))
 	}
 	boxID, backlinks, backmentions, linkRefsCount, mentionsCount := model.GetBacklink2(id, keyword, mentionKeyword, sort, mentionSort)
 	ret.Data = map[string]interface{}{