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) {
|
||||
if !config.Config.Callback.CallbackBeforeCreateGroup.Enable {
|
||||
if !config.Config.Callback.CallbackAfterCreateGroup.Enable {
|
||||
return nil
|
||||
}
|
||||
cbReq := &callbackstruct.CallbackBeforeCreateGroupReq{
|
||||
cbReq := &callbackstruct.CallbackAfterCreateGroupReq{
|
||||
CallbackCommand: "callbackAfterCreateGroupCommand",
|
||||
OperationID: mcontext.GetOperationID(ctx),
|
||||
GroupInfo: req.GroupInfo,
|
||||
@ -112,13 +112,13 @@ func CallbackAfterCreateGroup(ctx context.Context, req *group.CreateGroupReq) (e
|
||||
RoleLevel: constant.GroupOrdinaryUsers,
|
||||
})
|
||||
}
|
||||
resp := &callbackstruct.CallbackBeforeCreateGroupResp{}
|
||||
resp := &callbackstruct.CallbackAfterCreateGroupResp{}
|
||||
err = http.CallBackPostReturn(
|
||||
ctx,
|
||||
config.Config.Callback.CallbackUrl,
|
||||
cbReq,
|
||||
resp,
|
||||
config.Config.Callback.CallbackBeforeCreateGroup,
|
||||
config.Config.Callback.CallbackAfterCreateGroup,
|
||||
)
|
||||
if err != nil {
|
||||
if err == errs.ErrCallbackContinue {
|
||||
|
||||
@ -50,6 +50,17 @@ type CallbackBeforeCreateGroupResp struct {
|
||||
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 {
|
||||
CallbackCommand `json:"callbackCommand"`
|
||||
OperationID string `json:"operationID"`
|
||||
|
||||
@ -20,7 +20,6 @@ import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/http"
|
||||
urllib "net/url"
|
||||
"time"
|
||||
|
||||
"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 {
|
||||
defer log.ZDebug(ctx, "callback", "url", url, "command", command, "input", input, "callbackConfig", callbackConfig)
|
||||
|
||||
v := urllib.Values{}
|
||||
v.Set(constant.CallbackCommand, command)
|
||||
url = url + "?" + v.Encode()
|
||||
//
|
||||
//v := urllib.Values{}
|
||||
//v.Set(constant.CallbackCommand, command)
|
||||
//url = url + "/" + v.Encode()
|
||||
url = url + "/" + command
|
||||
|
||||
b, err := Post(ctx, url, nil, input, callbackConfig.CallbackTimeOut)
|
||||
if err != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user