diff --git a/internal/api/msg.go b/internal/api/msg.go index 392efcd9b..33295fbe5 100644 --- a/internal/api/msg.go +++ b/internal/api/msg.go @@ -31,6 +31,7 @@ import ( "github.com/mitchellh/mapstructure" "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" "github.com/openimsdk/open-im-server/v3/pkg/common/http" + pbmsg "github.com/openimsdk/open-im-server/v3/tools/data-conversion/openim/proto/msg" "time" "github.com/openimsdk/open-im-server/v3/pkg/authverify" @@ -425,8 +426,10 @@ func (m *MessageApi) CallbackExample(c *gin.Context) { } type token struct { - Token string `json:"token"` - ExpireTimeSeconds int64 `json:"expireTimeSeconds"` + ErrCode int `json:"errCode"` + ErrMsg string `json:"errMsg"` + ErrDlt string `json:"errDlt"` + Data auth.UserTokenResp `json:"data,omitempty"` } output_token := &token{} @@ -440,7 +443,7 @@ func (m *MessageApi) CallbackExample(c *gin.Context) { return } - log.ZDebug(c, "CallbackExample data Token", "token", output_token) + log.ZDebug(c, "CallbackExample data Token", "token", data) if err = json.Unmarshal(data, output_token); err != nil { log.ZError(c, "CallbackExample unmarshal userToken failed", err) @@ -474,11 +477,12 @@ func (m *MessageApi) CallbackExample(c *gin.Context) { } url = "http://127.0.0.1:10002/msg/send_msg" - header["token"] = output_token.Token + header["token"] = output_token.Data.Token type sendResp struct { - ServerMsgID string `json:"serverMsgID"` - ClientMsgID string `json:"clientMsgID"` - SendTime int64 `json:"sendTime"` + ErrCode int `json:"errCode"` + ErrMsg string `json:"errMsg"` + ErrDlt string `json:"errDlt"` + Data pbmsg.SendMsgResp `json:"data,omitempty"` } output := &sendResp{} diff --git a/pkg/common/http/http_client.go b/pkg/common/http/http_client.go index 0525a2826..a80d1c9a4 100644 --- a/pkg/common/http/http_client.go +++ b/pkg/common/http/http_client.go @@ -112,9 +112,7 @@ func callBackPostReturn(ctx context.Context, url, command string, input interfac //v.Set(constant.CallbackCommand, command) //url = url + "/" + v.Encode() url = url + "/" + command - header := map[string]string{} - header["operationID"] = ctx.Value(constant.OperationID).(string) - b, err := Post(ctx, url, header, input, callbackConfig.CallbackTimeOut) + b, err := Post(ctx, url, nil, input, callbackConfig.CallbackTimeOut) if err != nil { if callbackConfig.CallbackFailedContinue != nil && *callbackConfig.CallbackFailedContinue { log.ZWarn(ctx, "callback failed but continue", err, "url", url)