From 646383bf8fbcac9bcb8c7f41aad5c234b9b88cd7 Mon Sep 17 00:00:00 2001 From: luhaoling <2198702716@qq.com> Date: Wed, 17 Jan 2024 10:30:26 +0800 Subject: [PATCH] fix: find the req error --- internal/api/msg.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/internal/api/msg.go b/internal/api/msg.go index 99882d45e..0a68ac301 100644 --- a/internal/api/msg.go +++ b/internal/api/msg.go @@ -399,7 +399,7 @@ func (m *MessageApi) CallbackExample(c *gin.Context) { apiresp.GinError(c, errs.ErrArgs.WithDetail(err.Error()).Wrap()) return } - log.ZInfo(c, "CallbackExample", "req", req) + log.ZInfo(c, "QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ", "req", req) resp := &callbackstruct.CallbackAfterSendSingleMsgResp{ CommonCallbackResp: callbackstruct.CommonCallbackResp{ @@ -461,16 +461,23 @@ func (m *MessageApi) CallbackExample(c *gin.Context) { } content := make(map[string]any, 1) - log.ZDebug(c, "CallbackExample content content content content content content content content", "content", req.Content) - str := &apistruct.TextElem{} + log.ZDebug(c, "CallbackExample content content content content content content content content", req.Content) + + //{"operationID": "2390e1ce-7e66-4e70-b37e-4be483f22c3f", "content": "{\"content\":\"java\"}"} + type text struct { + OperationID string `json:"operationID"` + Context apistruct.TextElem `json:"context"` + } + str := &text{} err = json.Unmarshal([]byte(req.Content), str) if err != nil { log.ZError(c, "CallbackExample unmarshal failed", err) apiresp.GinError(c, errs.ErrInternalServer.WithDetail(err.Error()).Wrap()) return } + log.ZDebug(c, "CallbackExample TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT TEXT ", str) - content["content"] = str + content["content"] = str.Context.Content input := &apistruct.SendMsgReq{ RecvID: req.SendID, SendMsg: apistruct.SendMsg{ @@ -485,6 +492,7 @@ func (m *MessageApi) CallbackExample(c *gin.Context) { }, } + log.ZDebug(c, "CallbackExample input input input input input input input input input input input input ", input) url = "http://127.0.0.1:10002/msg/send_msg" header["token"] = output_token.Data.Token type sendResp struct {