fix: fix bugs

pull/1499/head
AndrewZuo01 2 years ago
parent 00711fca9a
commit 3dec53c1e0

@ -381,6 +381,10 @@ callback:
enable: ${CALLBACK_ENABLE} enable: ${CALLBACK_ENABLE}
timeout: ${CALLBACK_TIMEOUT} timeout: ${CALLBACK_TIMEOUT}
failedContinue: ${CALLBACK_FAILED_CONTINUE} failedContinue: ${CALLBACK_FAILED_CONTINUE}
afterSetGroupMemberInfo:
enable: ${CALLBACK_ENABLE}
timeout: ${CALLBACK_TIMEOUT}
failedContinue: ${CALLBACK_FAILED_CONTINUE}
setMessageReactionExtensions: setMessageReactionExtensions:
enable: ${CALLBACK_ENABLE} enable: ${CALLBACK_ENABLE}
timeout: ${CALLBACK_TIMEOUT} timeout: ${CALLBACK_TIMEOUT}

@ -200,7 +200,7 @@ func CallbackAfterSetGroupMemberInfo(ctx context.Context, req *group.SetGroupMem
return nil return nil
} }
callbackReq := callbackstruct.CallbackAfterSetGroupMemberInfoReq{ callbackReq := callbackstruct.CallbackAfterSetGroupMemberInfoReq{
CallbackCommand: callbackstruct.CallbackBeforeSetGroupMemberInfoCommand, CallbackCommand: callbackstruct.CallbackAfterSetGroupMemberInfoCommand,
GroupID: req.GroupID, GroupID: req.GroupID,
UserID: req.UserID, UserID: req.UserID,
} }
@ -217,7 +217,7 @@ func CallbackAfterSetGroupMemberInfo(ctx context.Context, req *group.SetGroupMem
callbackReq.Ex = &req.Ex.Value callbackReq.Ex = &req.Ex.Value
} }
resp := &callbackstruct.CallbackAfterSetGroupMemberInfoResp{} resp := &callbackstruct.CallbackAfterSetGroupMemberInfoResp{}
if err = http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, callbackReq, resp, config.Config.Callback.CallbackBeforeSetGroupMemberInfo); err != nil { if err = http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, callbackReq, resp, config.Config.Callback.CallbackAfterSetGroupMemberInfo); err != nil {
return err return err
} }
return nil return nil

@ -99,10 +99,10 @@ func callbackAfterSendSingleMsg(ctx context.Context, msg *pbchat.SendMsgReq) err
} }
func callbackBeforeSendGroupMsg(ctx context.Context, msg *pbchat.SendMsgReq) error { func callbackBeforeSendGroupMsg(ctx context.Context, msg *pbchat.SendMsgReq) error {
if !config.Config.Callback.CallbackAfterSendSingleMsg.Enable { if !config.Config.Callback.CallbackBeforeSendSingleMsg.Enable {
return nil return nil
} }
req := &cbapi.CallbackAfterSendGroupMsgReq{ req := &cbapi.CallbackBeforeSendGroupMsgReq{
CommonCallbackReq: toCommonCallback(ctx, msg, cbapi.CallbackBeforeSendGroupMsgCommand), CommonCallbackReq: toCommonCallback(ctx, msg, cbapi.CallbackBeforeSendGroupMsgCommand),
GroupID: msg.MsgData.GroupID, GroupID: msg.MsgData.GroupID,
} }
@ -180,7 +180,7 @@ func CallbackSingleMsgRead(ctx context.Context, req *cbapi.CallbackSingleMsgRead
} }
req.CallbackCommand = cbapi.CallbackSingleMsgRead req.CallbackCommand = cbapi.CallbackSingleMsgRead
resp := &cbapi.CallbackGroupMsgReadResp{} resp := &cbapi.CallbackSingleMsgReadResp{}
if err := http.CallBackPostReturn(ctx, cbURL(), req, resp, config.Config.Callback.CallbackMsgModify); err != nil { if err := http.CallBackPostReturn(ctx, cbURL(), req, resp, config.Config.Callback.CallbackMsgModify); err != nil {
return err return err
@ -197,8 +197,8 @@ func CallbackAfterRevokeMsg(ctx context.Context, req *pbchat.RevokeMsgReq) error
Seq: req.Seq, Seq: req.Seq,
UserID: req.UserID, UserID: req.UserID,
} }
resp := &cbapi.CallbackAfterSendGroupMsgResp{} resp := &cbapi.CallbackAfterRevokeMsgResp{}
if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, callbackReq, resp, config.Config.Callback.CallbackAfterSetGroupInfo); err != nil { if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, callbackReq, resp, config.Config.Callback.CallbackAfterRevokeMsg); err != nil {
if err == errs.ErrCallbackContinue { if err == errs.ErrCallbackContinue {
return nil return nil
} }

@ -91,8 +91,8 @@ func CallbackAfterUserRegister(ctx context.Context, req *pbuser.UserRegisterReq)
Users: req.Users, Users: req.Users,
} }
resp := &cbapi.CallbackBeforeUserRegisterResp{} resp := &cbapi.CallbackAfterUserRegisterResp{}
if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackBeforeUpdateUserInfo); err != nil { if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackAfterUpdateUserInfo); err != nil {
return err return err
} }
return nil return nil

@ -1,19 +1,19 @@
package callbackstruct package callbackstruct
const CallbackBeforeInviteJoinGroupCommand = "CallbackBeforeInviteJoinGroupCommand" const CallbackBeforeInviteJoinGroupCommand = "callbackBeforeInviteJoinGroupCommand"
const CallbackAfterJoinGroupCommand = "CallbackAfterJoinGroupCommand" const CallbackAfterJoinGroupCommand = "callbackAfterJoinGroupCommand"
const CallbackAfterSetGroupInfoCommand = "CallbackAfterSetGroupInfoCommand" const CallbackAfterSetGroupInfoCommand = "callbackAfterSetGroupInfoCommand"
const CallbackBeforeSetGroupInfoCommand = "CallbackBeforeSetGroupInfoCommand" const CallbackBeforeSetGroupInfoCommand = "callbackBeforeSetGroupInfoCommand"
const CallbackAfterRevokeMsgCommand = "CallbackBeforeAfterMsgCommand" const CallbackAfterRevokeMsgCommand = "callbackBeforeAfterMsgCommand"
const CallbackBeforeAddBlackCommand = "CallbackBeforeAddBlackCommand" const CallbackBeforeAddBlackCommand = "callbackBeforeAddBlackCommand"
const CallbackAfterAddFriendCommand = "CallbackAfterAddFriendCommand" const CallbackAfterAddFriendCommand = "callbackAfterAddFriendCommand"
const CallbackBeforeAddFriendAgreeCommand = "CallbackBeforeAddFriendAgreeCommand" const CallbackBeforeAddFriendAgreeCommand = "callbackBeforeAddFriendAgreeCommand"
const CallbackAfterDeleteFriendCommand = "CallbackAfterDeleteFriendCommand" const CallbackAfterDeleteFriendCommand = "callbackAfterDeleteFriendCommand"
const CallbackBeforeImportFriendsCommand = "CallbackBeforeImportFriendsCommand" const CallbackBeforeImportFriendsCommand = "callbackBeforeImportFriendsCommand"
const CallbackAfterImportFriendsCommand = "CallbackAfterImportFriendsCommand" const CallbackAfterImportFriendsCommand = "callbackAfterImportFriendsCommand"
const CallbackAfterRemoveBlackCommand = "CallbackAfterRemoveBlackCommand" const CallbackAfterRemoveBlackCommand = "callbackAfterRemoveBlackCommand"
const ( const (
CallbackQuitGroupCommand = "callbackQuitGroupCommand" CallbackQuitGroupCommand = "callbackQuitGroupCommand"
@ -44,5 +44,6 @@ const (
CallbackBeforeCreateGroupCommand = "callbackBeforeCreateGroupCommand" CallbackBeforeCreateGroupCommand = "callbackBeforeCreateGroupCommand"
CallbackAfterCreateGroupCommand = "callbackAfterCreateGroupCommand" CallbackAfterCreateGroupCommand = "callbackAfterCreateGroupCommand"
CallbackBeforeMemberJoinGroupCommand = "callbackBeforeMemberJoinGroupCommand" CallbackBeforeMemberJoinGroupCommand = "callbackBeforeMemberJoinGroupCommand"
CallbackBeforeSetGroupMemberInfoCommand = "CallbackBeforeSetGroupMemberInfoCommand" CallbackBeforeSetGroupMemberInfoCommand = "callbackBeforeSetGroupMemberInfoCommand"
CallbackAfterSetGroupMemberInfoCommand = "callbackAfterSetGroupMemberInfoCommand"
) )

@ -109,30 +109,6 @@ type CallbackAfterSetGroupMemberInfoResp struct {
CommonCallbackResp CommonCallbackResp
} }
type CallbackAfterGroupMemberExitReq struct {
CallbackCommand `json:"callbackCommand"`
GroupID string `json:"groupID"`
UserID string `json:"userID"`
GroupType *int32 `json:"groupType"`
ExitType string `json:"exitType"`
}
type CallbackAfterGroupMemberExitResp struct {
CommonCallbackResp
}
type CallbackAfterUngroupReq struct {
CallbackCommand `json:"callbackCommand"`
GroupID string `json:"groupID"`
GroupType *int32 `json:"groupType"`
OwnerID string `json:"ownerID"`
MemberList []string `json:"memberList"`
}
type CallbackAfterUngroupResp struct {
CommonCallbackResp
}
type CallbackQuitGroupReq struct { type CallbackQuitGroupReq struct {
CallbackCommand `json:"callbackCommand"` CallbackCommand `json:"callbackCommand"`
GroupID string `json:"groupID"` GroupID string `json:"groupID"`

@ -80,26 +80,6 @@ type CallbackMsgModifyCommandResp struct {
Ex *string `json:"ex"` Ex *string `json:"ex"`
} }
type CallbackSendGroupMsgErrorReq struct {
CommonCallbackReq
GroupID string `json:"groupID"`
}
type CallbackSendGroupMsgErrorResp struct {
CommonCallbackResp
}
type CallbackSingleMsgRevokeReq struct {
CallbackCommand `json:"callbackCommand"`
SendID string `json:"sendID"`
ReceiveID string `json:"receiveID"`
Content string `json:"content"`
}
type CallbackSingleMsgRevokeResp struct {
CommonCallbackResp
}
type CallbackGroupMsgReadReq struct { type CallbackGroupMsgReadReq struct {
CallbackCommand `json:"callbackCommand"` CallbackCommand `json:"callbackCommand"`
SendID string `json:"sendID"` SendID string `json:"sendID"`

@ -272,6 +272,7 @@ type configStruct struct {
CallbackAfterCreateGroup CallBackConfig `yaml:"afterCreateGroup"` CallbackAfterCreateGroup CallBackConfig `yaml:"afterCreateGroup"`
CallbackBeforeMemberJoinGroup CallBackConfig `yaml:"beforeMemberJoinGroup"` CallbackBeforeMemberJoinGroup CallBackConfig `yaml:"beforeMemberJoinGroup"`
CallbackBeforeSetGroupMemberInfo CallBackConfig `yaml:"beforeSetGroupMemberInfo"` CallbackBeforeSetGroupMemberInfo CallBackConfig `yaml:"beforeSetGroupMemberInfo"`
CallbackAfterSetGroupMemberInfo CallBackConfig `yaml:"afterSetGroupMemberInfo"`
CallbackQuitGroup CallBackConfig `yaml:"quitGroup"` CallbackQuitGroup CallBackConfig `yaml:"quitGroup"`
CallbackKillGroupMember CallBackConfig `yaml:"killGroupMember"` CallbackKillGroupMember CallBackConfig `yaml:"killGroupMember"`
CallbackDismissGroup CallBackConfig `yaml:"dismissGroup"` CallbackDismissGroup CallBackConfig `yaml:"dismissGroup"`

Loading…
Cancel
Save