🎨 Improve API lsNotebooks compatibility

This commit is contained in:
Liang Ding 2023-04-17 11:28:13 +08:00
parent 568e443717
commit 3f66a0d66f
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -308,14 +308,14 @@ func lsNotebooks(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
flashcard := false
if arg["flashcard"] != nil {
flashcard = arg["flashcard"].(bool)
// 兼容旧版接口,不能直接使用 util.JsonArg()
arg := map[string]interface{}{}
if err := c.ShouldBindJSON(&arg); nil == err {
if arg["flashcard"] != nil {
flashcard = arg["flashcard"].(bool)
}
}
var notebooks []*model.Box