This commit is contained in:
Liang Ding 2022-12-03 23:49:18 +08:00
parent c86b209fbe
commit 87f22f72e2
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
7 changed files with 284 additions and 203 deletions

View file

@ -25,6 +25,50 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func setCriterion(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["criterion"])
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
criterion := &model.Criterion{}
if err = gulu.JSON.UnmarshalJSON(param, criterion); nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
err = model.SetCriterion(criterion)
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
}
func getCriteria(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
data, err := model.GetCriteria()
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
ret.Data = data
}
func removeLocalStorageVal(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)