🎨 Add kernel API /api/riff/getRiffCardsByBlockIDs Fix https://github.com/siyuan-note/siyuan/issues/10535

This commit is contained in:
Daniel 2024-03-07 20:36:47 +08:00
parent d55dcf1bf7
commit e083dacca8
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 54 additions and 4 deletions

View file

@ -27,6 +27,33 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func getRiffCardsByBlockIDs(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
blockIDsArg := arg["blockIDs"].([]interface{})
var blockIDs []string
for _, blockID := range blockIDsArg {
blockIDs = append(blockIDs, blockID.(string))
}
page := int(arg["page"].(float64))
pageSize := 20
if nil != arg["pageSize"] {
pageSize = int(arg["pageSize"].(float64))
}
blocks, total, pageCount := model.GetFlashcardsByBlockIDs(blockIDs, page, pageSize)
ret.Data = map[string]interface{}{
"blocks": blocks,
"total": total,
"pageCount": pageCount,
}
}
func batchSetRiffCardsDueTime(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)