소스 검색

:art: 数据快照 https://github.com/siyuan-note/siyuan/issues/5159

Liang Ding 3 년 전
부모
커밋
86f31a5d21
4개의 변경된 파일9개의 추가작업 그리고 17개의 파일을 삭제
  1. 4 2
      kernel/api/repo.go
  2. 1 1
      kernel/go.mod
  3. 2 2
      kernel/go.sum
  4. 2 12
      kernel/model/repository.go

+ 4 - 2
kernel/api/repo.go

@@ -55,14 +55,16 @@ func getRepoIndexLogs(c *gin.Context) {
 	}
 
 	page := arg["page"].(float64)
-	logs, err := model.GetRepoIndexLogs(int(page))
+	logs, pageCount, totalCount, err := model.GetRepoIndexLogs(int(page))
 	if nil != err {
 		ret.Code = -1
 		ret.Msg = err.Error()
 		return
 	}
 	ret.Data = map[string]interface{}{
-		"logs": logs,
+		"logs":       logs,
+		"pageCount":  pageCount,
+		"totalCount": totalCount,
 	}
 }
 

+ 1 - 1
kernel/go.mod

@@ -40,7 +40,7 @@ require (
 	github.com/patrickmn/go-cache v2.1.0+incompatible
 	github.com/qiniu/go-sdk/v7 v7.13.0
 	github.com/radovskyb/watcher v1.0.7
-	github.com/siyuan-note/dejavu v0.0.0-20220613154907-7c4058d9f1e1
+	github.com/siyuan-note/dejavu v0.0.0-20220614033429-787e55760d7e
 	github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676
 	github.com/vmihailenco/msgpack/v5 v5.3.5
 	github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673

+ 2 - 2
kernel/go.sum

@@ -419,8 +419,8 @@ github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJ
 github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
 github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
 github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
-github.com/siyuan-note/dejavu v0.0.0-20220613154907-7c4058d9f1e1 h1:Z0Q4sjonCyTc0SHor86LM+oP6DM8wL6Xx+BKtReees4=
-github.com/siyuan-note/dejavu v0.0.0-20220613154907-7c4058d9f1e1/go.mod h1:Oa/Y6fvTUCg8h9/t6GNWXiu8T7aQri/ZvyDRygnlikI=
+github.com/siyuan-note/dejavu v0.0.0-20220614033429-787e55760d7e h1:cvgb8q8L2vKV9PI7dDMtOI7bsZ9YEWhfYHn5Nd6ijVY=
+github.com/siyuan-note/dejavu v0.0.0-20220614033429-787e55760d7e/go.mod h1:Oa/Y6fvTUCg8h9/t6GNWXiu8T7aQri/ZvyDRygnlikI=
 github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676 h1:QB9TjJQFhXhZ6dAtPpY02DlzHAQm1C+WqZq6OadG8mI=
 github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
 github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=

+ 2 - 12
kernel/model/repository.go

@@ -30,17 +30,7 @@ import (
 	"github.com/siyuan-note/siyuan/kernel/util"
 )
 
-func GetRepoFile(id string) (ret []byte, err error) {
-	//repo, err := dejavu.NewRepo(util.DataDir, util.RepoDir, Conf.Repo.Key)
-	//if nil != err {
-	//	util.LogErrorf("init repo failed: %s", err)
-	//	return
-	//}
-
-	return
-}
-
-func GetRepoIndexLogs(page int) (logs []*dejavu.Log, err error) {
+func GetRepoIndexLogs(page int) (logs []*dejavu.Log, pageCount, totalCount int, err error) {
 	repo, err := dejavu.NewRepo(util.DataDir, util.RepoDir, Conf.Repo.Key)
 	if nil != err {
 		util.LogErrorf("init repo failed: %s", err)
@@ -48,7 +38,7 @@ func GetRepoIndexLogs(page int) (logs []*dejavu.Log, err error) {
 	}
 
 	page-- // 从 0 开始
-	logs, err = repo.GetIndexLogs(page, 32)
+	logs, pageCount, totalCount, err = repo.GetIndexLogs(page, 32)
 	if nil != err {
 		util.LogErrorf("get repo index logs failed: %s", err)
 		return