Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: 支持浏览卡包内的闪卡 https://github.com/siyuan-note/siyuan/issues/6943

Liang Ding38570cb27fed
diff --git a/kernel/api/riff.go b/kernel/api/riff.go
index fb8bc54f07..3841a2815c 100644
--- a/kernel/api/riff.go
+++ b/kernel/api/riff.go
@@ -38,9 +38,11 @@ func getRiffCards(c *gin.Context) {
deckID := arg["deckID"].(string)
page := int(arg["page"].(float64))
- blockIDs := model.GetFlashcards(deckID, page)
+ blockIDs, total, pageCount := model.GetFlashcards(deckID, page)
ret.Data = map[string]interface{}{
- "blockIDs": blockIDs,
+ "blockIDs": blockIDs,
+ "total": total,
+ "pageCount": pageCount,
}
}
diff --git a/kernel/model/flashcard.go b/kernel/model/flashcard.go
index 4d45ad4d8c..c292b9b0d2 100644
--- a/kernel/model/flashcard.go
+++ b/kernel/model/flashcard.go
@@ -39,7 +39,7 @@ import (
var Decks = map[string]*riff.Deck{}
var deckLock = sync.Mutex{}
-func GetFlashcards(deckID string, page int) (blockIDs []string) {
+func GetFlashcards(deckID string, page int) (blockIDs []string, total, pageCount int) {
deck := Decks[deckID]
if nil == deck {
return
@@ -60,6 +60,8 @@ func GetFlashcards(deckID string, page int) (blockIDs []string) {
end = len(allBlockIDs)
}
blockIDs = allBlockIDs[start:end]
+ total = len(allBlockIDs)
+ pageCount = total / 20
return
}