diff --git a/internal/api/msg.go b/internal/api/msg.go index c2435c6ba..d59782d07 100644 --- a/internal/api/msg.go +++ b/internal/api/msg.go @@ -428,6 +428,9 @@ func (m *MessageApi) CallbackExample(c *gin.Context) { text := apistruct.TextElem{} picture := apistruct.PictureElem{} mapStruct := make(map[string]any) + mapStructSnap := make(map[string]interface{}) + mapStructBig := make(map[string]interface{}) + mapStructSource := make(map[string]interface{}) if req.ContentType == constant.Text { err = json.Unmarshal([]byte(req.Content), &text) if err != nil { @@ -458,7 +461,7 @@ func (m *MessageApi) CallbackExample(c *gin.Context) { if len(picture.SnapshotPicture.Type) == 0 { picture.SnapshotPicture.Type = picture.SourcePicture.Type } - mapStructSnap := make(map[string]interface{}) + mapStructSnap, err = convertStructToMap(picture.SnapshotPicture) if err != nil { log.ZError(c, "CallbackExample struct to map failed", err) @@ -467,7 +470,6 @@ func (m *MessageApi) CallbackExample(c *gin.Context) { } mapStruct["snapshotPicture"] = mapStructSnap - mapStructBig := make(map[string]interface{}) mapStructBig, err = convertStructToMap(picture.BigPicture) if err != nil { log.ZError(c, "CallbackExample struct to map failed", err) @@ -476,7 +478,6 @@ func (m *MessageApi) CallbackExample(c *gin.Context) { } mapStruct["bigPicture"] = mapStructBig - mapStructSource := make(map[string]interface{}) mapStructSource, err = convertStructToMap(picture.SourcePicture) if err != nil { log.ZError(c, "CallbackExample struct to map failed", err)