mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-07 21:17:17 +08:00
fix:fix the url
This commit is contained in:
parent
08b045c864
commit
0e261d0db2
@ -88,10 +88,10 @@ func CallbackBeforeCreateGroup(ctx context.Context, req *group.CreateGroupReq) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
func CallbackAfterCreateGroup(ctx context.Context, req *group.CreateGroupReq) (err error) {
|
func CallbackAfterCreateGroup(ctx context.Context, req *group.CreateGroupReq) (err error) {
|
||||||
if !config.Config.Callback.CallbackBeforeCreateGroup.Enable {
|
if !config.Config.Callback.CallbackAfterCreateGroup.Enable {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
cbReq := &callbackstruct.CallbackBeforeCreateGroupReq{
|
cbReq := &callbackstruct.CallbackAfterCreateGroupReq{
|
||||||
CallbackCommand: "callbackAfterCreateGroupCommand",
|
CallbackCommand: "callbackAfterCreateGroupCommand",
|
||||||
OperationID: mcontext.GetOperationID(ctx),
|
OperationID: mcontext.GetOperationID(ctx),
|
||||||
GroupInfo: req.GroupInfo,
|
GroupInfo: req.GroupInfo,
|
||||||
@ -112,13 +112,13 @@ func CallbackAfterCreateGroup(ctx context.Context, req *group.CreateGroupReq) (e
|
|||||||
RoleLevel: constant.GroupOrdinaryUsers,
|
RoleLevel: constant.GroupOrdinaryUsers,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
resp := &callbackstruct.CallbackBeforeCreateGroupResp{}
|
resp := &callbackstruct.CallbackAfterCreateGroupResp{}
|
||||||
err = http.CallBackPostReturn(
|
err = http.CallBackPostReturn(
|
||||||
ctx,
|
ctx,
|
||||||
config.Config.Callback.CallbackUrl,
|
config.Config.Callback.CallbackUrl,
|
||||||
cbReq,
|
cbReq,
|
||||||
resp,
|
resp,
|
||||||
config.Config.Callback.CallbackBeforeCreateGroup,
|
config.Config.Callback.CallbackAfterCreateGroup,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == errs.ErrCallbackContinue {
|
if err == errs.ErrCallbackContinue {
|
||||||
|
|||||||
@ -50,6 +50,17 @@ type CallbackBeforeCreateGroupResp struct {
|
|||||||
ApplyMemberFriend *int32 `json:"applyMemberFriend"`
|
ApplyMemberFriend *int32 `json:"applyMemberFriend"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type CallbackAfterCreateGroupReq struct {
|
||||||
|
OperationID string `json:"operationID"`
|
||||||
|
CallbackCommand `json:"callbackCommand"`
|
||||||
|
*common.GroupInfo
|
||||||
|
InitMemberList []*apistruct.GroupAddMemberInfo `json:"initMemberList"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CallbackAfterCreateGroupResp struct {
|
||||||
|
CommonCallbackResp
|
||||||
|
}
|
||||||
|
|
||||||
type CallbackBeforeMemberJoinGroupReq struct {
|
type CallbackBeforeMemberJoinGroupReq struct {
|
||||||
CallbackCommand `json:"callbackCommand"`
|
CallbackCommand `json:"callbackCommand"`
|
||||||
OperationID string `json:"operationID"`
|
OperationID string `json:"operationID"`
|
||||||
|
|||||||
@ -20,7 +20,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
urllib "net/url"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/OpenIMSDK/protocol/constant"
|
"github.com/OpenIMSDK/protocol/constant"
|
||||||
@ -108,10 +107,11 @@ func PostReturn(ctx context.Context, url string, header map[string]string, input
|
|||||||
|
|
||||||
func callBackPostReturn(ctx context.Context, url, command string, input interface{}, output callbackstruct.CallbackResp, callbackConfig config.CallBackConfig) error {
|
func callBackPostReturn(ctx context.Context, url, command string, input interface{}, output callbackstruct.CallbackResp, callbackConfig config.CallBackConfig) error {
|
||||||
defer log.ZDebug(ctx, "callback", "url", url, "command", command, "input", input, "callbackConfig", callbackConfig)
|
defer log.ZDebug(ctx, "callback", "url", url, "command", command, "input", input, "callbackConfig", callbackConfig)
|
||||||
|
//
|
||||||
v := urllib.Values{}
|
//v := urllib.Values{}
|
||||||
v.Set(constant.CallbackCommand, command)
|
//v.Set(constant.CallbackCommand, command)
|
||||||
url = url + "?" + v.Encode()
|
//url = url + "/" + v.Encode()
|
||||||
|
url = url + "/" + command
|
||||||
|
|
||||||
b, err := Post(ctx, url, nil, input, callbackConfig.CallbackTimeOut)
|
b, err := Post(ctx, url, nil, input, callbackConfig.CallbackTimeOut)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user