mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-02 18:34:29 +08:00
fix: change the resp struct
This commit is contained in:
parent
10f2157494
commit
d68f111cc4
@ -31,6 +31,7 @@ import (
|
|||||||
"github.com/mitchellh/mapstructure"
|
"github.com/mitchellh/mapstructure"
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
|
"github.com/openimsdk/open-im-server/v3/pkg/callbackstruct"
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/http"
|
"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"
|
"time"
|
||||||
|
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/authverify"
|
"github.com/openimsdk/open-im-server/v3/pkg/authverify"
|
||||||
@ -425,8 +426,10 @@ func (m *MessageApi) CallbackExample(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type token struct {
|
type token struct {
|
||||||
Token string `json:"token"`
|
ErrCode int `json:"errCode"`
|
||||||
ExpireTimeSeconds int64 `json:"expireTimeSeconds"`
|
ErrMsg string `json:"errMsg"`
|
||||||
|
ErrDlt string `json:"errDlt"`
|
||||||
|
Data auth.UserTokenResp `json:"data,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
output_token := &token{}
|
output_token := &token{}
|
||||||
@ -440,7 +443,7 @@ func (m *MessageApi) CallbackExample(c *gin.Context) {
|
|||||||
return
|
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 {
|
if err = json.Unmarshal(data, output_token); err != nil {
|
||||||
log.ZError(c, "CallbackExample unmarshal userToken failed", err)
|
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"
|
url = "http://127.0.0.1:10002/msg/send_msg"
|
||||||
header["token"] = output_token.Token
|
header["token"] = output_token.Data.Token
|
||||||
type sendResp struct {
|
type sendResp struct {
|
||||||
ServerMsgID string `json:"serverMsgID"`
|
ErrCode int `json:"errCode"`
|
||||||
ClientMsgID string `json:"clientMsgID"`
|
ErrMsg string `json:"errMsg"`
|
||||||
SendTime int64 `json:"sendTime"`
|
ErrDlt string `json:"errDlt"`
|
||||||
|
Data pbmsg.SendMsgResp `json:"data,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
output := &sendResp{}
|
output := &sendResp{}
|
||||||
|
|||||||
@ -112,9 +112,7 @@ func callBackPostReturn(ctx context.Context, url, command string, input interfac
|
|||||||
//v.Set(constant.CallbackCommand, command)
|
//v.Set(constant.CallbackCommand, command)
|
||||||
//url = url + "/" + v.Encode()
|
//url = url + "/" + v.Encode()
|
||||||
url = url + "/" + command
|
url = url + "/" + command
|
||||||
header := map[string]string{}
|
b, err := Post(ctx, url, nil, input, callbackConfig.CallbackTimeOut)
|
||||||
header["operationID"] = ctx.Value(constant.OperationID).(string)
|
|
||||||
b, err := Post(ctx, url, header, input, callbackConfig.CallbackTimeOut)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if callbackConfig.CallbackFailedContinue != nil && *callbackConfig.CallbackFailedContinue {
|
if callbackConfig.CallbackFailedContinue != nil && *callbackConfig.CallbackFailedContinue {
|
||||||
log.ZWarn(ctx, "callback failed but continue", err, "url", url)
|
log.ZWarn(ctx, "callback failed but continue", err, "url", url)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user