🧑‍💻 Improve /api/storage/getRecentDocs (#16257)

fix https://github.com/siyuan-note/siyuan/issues/16256
This commit is contained in:
Jeffrey Chen 2025-11-01 10:36:47 +08:00 committed by GitHub
parent c2157ca060
commit a0f5387bb4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -29,16 +29,16 @@ func getRecentDocs(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
// 获取排序参数
sortBy := "viewedAt" // 默认按浏览时间排序openAt按打开时间排序closedAt按关闭时间排序
// 兼容旧版接口,不能直接使用 util.JsonArg()
arg := map[string]interface{}{}
if err := c.ShouldBindJSON(&arg); err == nil {
if arg["sortBy"] != nil {
sortBy = arg["sortBy"].(string)
}
}
data, err := model.GetRecentDocs(sortBy)
if err != nil {