This commit is contained in:
Daniel 2025-07-01 21:50:32 +08:00
parent 3595312920
commit 724db336c8
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
4 changed files with 47 additions and 11 deletions

View file

@ -27,6 +27,40 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func setAttrViewGroup(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
avID := arg["avID"].(string)
blockID := arg["blockID"].(string)
groupArg := arg["group"].(map[string]interface{})
data, err := gulu.JSON.MarshalJSON(groupArg)
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
group := &av.ViewGroup{}
if err = gulu.JSON.UnmarshalJSON(data, group); nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
err = model.SetAttributeViewGroup(avID, blockID, group)
if err != nil {
ret.Code = -1
ret.Msg = err.Error()
return
}
}
func changeAttrViewLayout(c *gin.Context) {
ret := gulu.Ret.NewResult()
arg, ok := util.JsonArg(c, ret)

View file

@ -455,6 +455,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/av/appendAttributeViewDetachedBlocksWithValues", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, appendAttributeViewDetachedBlocksWithValues)
ginServer.Handle("POST", "/api/av/getCurrentAttrViewImages", model.CheckAuth, getCurrentAttrViewImages)
ginServer.Handle("POST", "/api/av/changeAttrViewLayout", model.CheckAuth, changeAttrViewLayout)
ginServer.Handle("POST", "/api/av/setAttrViewGroup", model.CheckAuth, setAttrViewGroup)
ginServer.Handle("POST", "/api/ai/chatGPT", model.CheckAuth, model.CheckAdminRole, chatGPT)
ginServer.Handle("POST", "/api/ai/chatGPTWithAction", model.CheckAuth, model.CheckAdminRole, chatGPTWithAction)