fix: fix bugs

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

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

@ -200,7 +200,7 @@ func CallbackAfterSetGroupMemberInfo(ctx context.Context, req *group.SetGroupMem
return nil
}
callbackReq := callbackstruct.CallbackAfterSetGroupMemberInfoReq{
CallbackCommand: callbackstruct.CallbackBeforeSetGroupMemberInfoCommand,
CallbackCommand: callbackstruct.CallbackAfterSetGroupMemberInfoCommand,
GroupID: req.GroupID,
UserID: req.UserID,
}
@ -217,7 +217,7 @@ func CallbackAfterSetGroupMemberInfo(ctx context.Context, req *group.SetGroupMem
callbackReq.Ex = &req.Ex.Value
}
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 nil

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

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

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

@ -109,30 +109,6 @@ type CallbackAfterSetGroupMemberInfoResp struct {
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 {
CallbackCommand `json:"callbackCommand"`
GroupID string `json:"groupID"`

@ -80,26 +80,6 @@ type CallbackMsgModifyCommandResp struct {
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 {
CallbackCommand `json:"callbackCommand"`
SendID string `json:"sendID"`

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

Loading…
Cancel
Save