🎨 支持列出和切换最近打开的文档 https://github.com/siyuan-note/siyuan/issues/3293

This commit is contained in:
Liang Ding 2022-12-10 17:07:33 +08:00
parent 507f53783a
commit b3a147d60b
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
3 changed files with 130 additions and 0 deletions

View file

@ -25,6 +25,50 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func setRecentDoc(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
param, err := gulu.JSON.MarshalJSON(arg["recentDoc"])
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
recentDoc := &model.RecentDoc{}
if err = gulu.JSON.UnmarshalJSON(param, recentDoc); nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
err = model.SetRecentDoc(recentDoc)
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
}
func getRecentDocs(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
data, err := model.GetRecentDocs()
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
ret.Data = data
}
func removeCriterion(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)