diff --git a/internal/rpc/group/callback.go b/internal/rpc/group/callback.go index c6d0e6ff5..887aaf8aa 100644 --- a/internal/rpc/group/callback.go +++ b/internal/rpc/group/callback.go @@ -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 { diff --git a/pkg/callbackstruct/group.go b/pkg/callbackstruct/group.go index 423f31fab..5ec6433b6 100644 --- a/pkg/callbackstruct/group.go +++ b/pkg/callbackstruct/group.go @@ -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"` diff --git a/pkg/common/http/http_client.go b/pkg/common/http/http_client.go index e0cedf357..c45e9f8ad 100644 --- a/pkg/common/http/http_client.go +++ b/pkg/common/http/http_client.go @@ -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 {