mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-03 19:02:31 +08:00
update callback enable
This commit is contained in:
parent
4c96187c1f
commit
1789a8e73f
@ -33,6 +33,7 @@ func CallbackBeforeAddFriend(ctx context.Context, req *pbfriend.ApplyToAddFriend
|
|||||||
FromUserID: req.FromUserID,
|
FromUserID: req.FromUserID,
|
||||||
ToUserID: req.ToUserID,
|
ToUserID: req.ToUserID,
|
||||||
ReqMsg: req.ReqMsg,
|
ReqMsg: req.ReqMsg,
|
||||||
|
Ex: req.Ex,
|
||||||
}
|
}
|
||||||
resp := &cbapi.CallbackBeforeAddFriendResp{}
|
resp := &cbapi.CallbackBeforeAddFriendResp{}
|
||||||
if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackBeforeAddFriend); err != nil {
|
if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackBeforeAddFriend); err != nil {
|
||||||
@ -91,7 +92,6 @@ func CallbackBeforeAddBlack(ctx context.Context, req *pbfriend.AddBlackReq) erro
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
utils.StructFieldNotNilReplace(req, resp)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func CallbackAfterAddFriend(ctx context.Context, req *pbfriend.ApplyToAddFriendReq) error {
|
func CallbackAfterAddFriend(ctx context.Context, req *pbfriend.ApplyToAddFriendReq) error {
|
||||||
@ -111,7 +111,7 @@ func CallbackAfterAddFriend(ctx context.Context, req *pbfriend.ApplyToAddFriendR
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
utils.StructFieldNotNilReplace(req, resp)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func CallbackBeforeAddFriendAgree(ctx context.Context, req *pbfriend.RespondFriendApplyReq) error {
|
func CallbackBeforeAddFriendAgree(ctx context.Context, req *pbfriend.RespondFriendApplyReq) error {
|
||||||
@ -132,7 +132,6 @@ func CallbackBeforeAddFriendAgree(ctx context.Context, req *pbfriend.RespondFrie
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
utils.StructFieldNotNilReplace(req, resp)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func CallbackAfterDeleteFriend(ctx context.Context, req *pbfriend.DeleteFriendReq) error {
|
func CallbackAfterDeleteFriend(ctx context.Context, req *pbfriend.DeleteFriendReq) error {
|
||||||
@ -151,7 +150,6 @@ func CallbackAfterDeleteFriend(ctx context.Context, req *pbfriend.DeleteFriendRe
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
utils.StructFieldNotNilReplace(req, resp)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func CallbackBeforeImportFriends(ctx context.Context, req *pbfriend.ImportFriendReq) error {
|
func CallbackBeforeImportFriends(ctx context.Context, req *pbfriend.ImportFriendReq) error {
|
||||||
@ -170,7 +168,9 @@ func CallbackBeforeImportFriends(ctx context.Context, req *pbfriend.ImportFriend
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
utils.StructFieldNotNilReplace(req, resp)
|
if len(resp.FriendUserIDs) != 0 {
|
||||||
|
req.FriendUserIDs = resp.FriendUserIDs
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func CallbackAfterImportFriends(ctx context.Context, req *pbfriend.ImportFriendReq) error {
|
func CallbackAfterImportFriends(ctx context.Context, req *pbfriend.ImportFriendReq) error {
|
||||||
@ -189,7 +189,6 @@ func CallbackAfterImportFriends(ctx context.Context, req *pbfriend.ImportFriendR
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
utils.StructFieldNotNilReplace(req, resp)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,6 +208,5 @@ func CallbackAfterRemoveBlack(ctx context.Context, req *pbfriend.RemoveBlackReq)
|
|||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
utils.StructFieldNotNilReplace(req, resp)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -103,7 +103,7 @@ func (s *friendServer) ApplyToAddFriend(
|
|||||||
if req.ToUserID == req.FromUserID {
|
if req.ToUserID == req.FromUserID {
|
||||||
return nil, errs.ErrCanNotAddYourself.Wrap()
|
return nil, errs.ErrCanNotAddYourself.Wrap()
|
||||||
}
|
}
|
||||||
if err := CallbackBeforeAddFriend(ctx, req); err != nil && err != errs.ErrCallbackContinue {
|
if err = CallbackBeforeAddFriend(ctx, req); err != nil && err != errs.ErrCallbackContinue {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if _, err := s.userRpcClient.GetUsersInfoMap(ctx, []string{req.ToUserID, req.FromUserID}); err != nil {
|
if _, err := s.userRpcClient.GetUsersInfoMap(ctx, []string{req.ToUserID, req.FromUserID}); err != nil {
|
||||||
@ -120,7 +120,7 @@ func (s *friendServer) ApplyToAddFriend(
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
s.notificationSender.FriendApplicationAddNotification(ctx, req)
|
s.notificationSender.FriendApplicationAddNotification(ctx, req)
|
||||||
if err := CallbackAfterAddFriend(ctx, req); err != nil && err != errs.ErrCallbackContinue {
|
if err = CallbackAfterAddFriend(ctx, req); err != nil && err != errs.ErrCallbackContinue {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return resp, nil
|
return resp, nil
|
||||||
|
|||||||
@ -19,6 +19,7 @@ type CallbackBeforeAddFriendReq struct {
|
|||||||
FromUserID string `json:"fromUserID" `
|
FromUserID string `json:"fromUserID" `
|
||||||
ToUserID string `json:"toUserID"`
|
ToUserID string `json:"toUserID"`
|
||||||
ReqMsg string `json:"reqMsg"`
|
ReqMsg string `json:"reqMsg"`
|
||||||
|
Ex string `json:"ex"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type CallbackBeforeAddFriendResp struct {
|
type CallbackBeforeAddFriendResp struct {
|
||||||
@ -105,6 +106,7 @@ type CallbackBeforeImportFriendsReq struct {
|
|||||||
}
|
}
|
||||||
type CallbackBeforeImportFriendsResp struct {
|
type CallbackBeforeImportFriendsResp struct {
|
||||||
CommonCallbackResp
|
CommonCallbackResp
|
||||||
|
FriendUserIDs []string `json:"friendUserIDs"`
|
||||||
}
|
}
|
||||||
type CallbackAfterImportFriendsReq struct {
|
type CallbackAfterImportFriendsReq struct {
|
||||||
CallbackCommand `json:"callbackCommand"`
|
CallbackCommand `json:"callbackCommand"`
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user