From 44f1578d8eaf2fe65b415ff4b037f1527bf74e19 Mon Sep 17 00:00:00 2001 From: AndrewZuo01 Date: Thu, 23 Nov 2023 16:21:36 +0800 Subject: [PATCH] fix eventtime --- internal/rpc/friend/callback.go | 12 +----------- internal/rpc/group/callback.go | 4 ---- internal/rpc/msg/callback.go | 7 ++----- pkg/callbackstruct/friend.go | 14 +++----------- pkg/callbackstruct/group.go | 4 ---- pkg/callbackstruct/revoke.go | 1 - 6 files changed, 6 insertions(+), 36 deletions(-) diff --git a/internal/rpc/friend/callback.go b/internal/rpc/friend/callback.go index 9358024fa..886acbb2e 100644 --- a/internal/rpc/friend/callback.go +++ b/internal/rpc/friend/callback.go @@ -16,12 +16,10 @@ package friend import ( "context" - "github.com/OpenIMSDK/tools/utils" - "time" - "github.com/OpenIMSDK/protocol/constant" pbfriend "github.com/OpenIMSDK/protocol/friend" "github.com/OpenIMSDK/tools/errs" + "github.com/OpenIMSDK/tools/utils" cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" "github.com/openimsdk/open-im-server/v3/pkg/common/config" "github.com/openimsdk/open-im-server/v3/pkg/common/http" @@ -36,7 +34,6 @@ func CallbackBeforeAddFriend(ctx context.Context, req *pbfriend.ApplyToAddFriend FromUserID: req.FromUserID, ToUserID: req.ToUserID, ReqMsg: req.ReqMsg, - EventTime: time.Now().Unix(), } resp := &cbapi.CallbackBeforeAddFriendResp{} if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackBeforeAddFriend); err != nil { @@ -55,7 +52,6 @@ func CallbackBeforeAddBlack(ctx context.Context, req *pbfriend.AddBlackReq) erro CallbackCommand: cbapi.CallbackBeforeAddBlackCommand, OwnerUserID: req.OwnerUserID, BlackUserID: req.BlackUserID, - EventTime: time.Now().Unix(), } resp := &cbapi.CallbackBeforeAddBlackResp{} if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackBeforeAddBlack); err != nil { @@ -76,7 +72,6 @@ func CallbackAfterAddFriend(ctx context.Context, req *pbfriend.ApplyToAddFriendR FromUserID: req.FromUserID, ToUserID: req.ToUserID, ReqMsg: req.ReqMsg, - EventTime: time.Now().Unix(), } resp := &cbapi.CallbackAfterAddFriendResp{} if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackAfterAddFriend); err != nil { @@ -98,7 +93,6 @@ func CallbackBeforeAddFriendAgree(ctx context.Context, req *pbfriend.RespondFrie ToUserID: req.ToUserID, HandleMsg: req.HandleMsg, HandleResult: req.HandleResult, - EventTime: time.Now().Unix(), } resp := &cbapi.CallbackBeforeAddFriendAgreeResp{} if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackBeforeAddFriendAgree); err != nil { @@ -118,7 +112,6 @@ func CallbackAfterDeleteFriend(ctx context.Context, req *pbfriend.DeleteFriendRe CallbackCommand: cbapi.CallbackAfterDeleteFriendCommand, OwnerUserID: req.OwnerUserID, FriendUserID: req.FriendUserID, - EventTime: time.Now().UnixMilli(), } resp := &cbapi.CallbackAfterDeleteFriendResp{} if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackAfterDeleteFriend); err != nil { @@ -138,7 +131,6 @@ func CallbackBeforeImportFriends(ctx context.Context, req *pbfriend.ImportFriend CallbackCommand: cbapi.CallbackBeforeImportFriendsCommand, OwnerUserID: req.OwnerUserID, FriendUserIDs: req.FriendUserIDs, - EventTime: time.Now().UnixMilli(), } resp := &cbapi.CallbackBeforeImportFriendsResp{} if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackBeforeImportFriends); err != nil { @@ -158,7 +150,6 @@ func CallbackAfterImportFriends(ctx context.Context, req *pbfriend.ImportFriendR CallbackCommand: cbapi.CallbackAfterImportFriendsCommand, OwnerUserID: req.OwnerUserID, FriendUserIDs: req.FriendUserIDs, - EventTime: time.Now().UnixMilli(), } resp := &cbapi.CallbackAfterImportFriendsResp{} if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackAfterImportFriends); err != nil { @@ -179,7 +170,6 @@ func CallbackAfterRemoveBlack(ctx context.Context, req *pbfriend.RemoveBlackReq) CallbackCommand: cbapi.CallbackAfterRemoveBlackCommand, OwnerUserID: req.OwnerUserID, BlackUserID: req.BlackUserID, - EventTime: time.Now().UnixMilli(), } resp := &cbapi.CallbackAfterRemoveBlackResp{} if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, cbReq, resp, config.Config.Callback.CallbackAfterRemoveBlack); err != nil { diff --git a/internal/rpc/group/callback.go b/internal/rpc/group/callback.go index 3b33a96d7..1e80a3f82 100644 --- a/internal/rpc/group/callback.go +++ b/internal/rpc/group/callback.go @@ -183,7 +183,6 @@ func CallbackBeforeInviteUserToGroup(ctx context.Context, req *group.InviteUserT GroupID: req.GroupID, Reason: req.Reason, InvitedUserIDs: req.InvitedUserIDs, - EventTime: time.Now().Unix(), } resp := &callbackstruct.CallbackBeforeInviteUserToGroupResp{} @@ -219,7 +218,6 @@ func CallbackAfterJoinGroup(ctx context.Context, req *group.JoinGroupReq) error ReqMessage: req.ReqMessage, JoinSource: req.JoinSource, InviterUserID: req.InviterUserID, - EventTime: time.Now().Unix(), } resp := &callbackstruct.CallbackAfterJoinGroupResp{} if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, callbackReq, resp, config.Config.Callback.CallbackAfterJoinGroup); err != nil { @@ -242,7 +240,6 @@ func CallbackBeforeSetGroupInfo(ctx context.Context, req *group.SetGroupInfoReq) Introduction: req.GroupInfoForSet.Introduction, FaceURL: req.GroupInfoForSet.FaceURL, GroupName: req.GroupInfoForSet.GroupName, - EventTime: time.Now().Unix(), } if req.GroupInfoForSet.Ex != nil { @@ -293,7 +290,6 @@ func CallbackAfterSetGroupInfo(ctx context.Context, req *group.SetGroupInfoReq) Introduction: req.GroupInfoForSet.Introduction, FaceURL: req.GroupInfoForSet.FaceURL, GroupName: req.GroupInfoForSet.GroupName, - EventTime: time.Now().Unix(), } if req.GroupInfoForSet.Ex != nil { callbackReq.Ex = &req.GroupInfoForSet.Ex.Value diff --git a/internal/rpc/msg/callback.go b/internal/rpc/msg/callback.go index 498170a07..63952f2af 100644 --- a/internal/rpc/msg/callback.go +++ b/internal/rpc/msg/callback.go @@ -16,16 +16,14 @@ package msg import ( "context" - "github.com/OpenIMSDK/protocol/sdkws" - "google.golang.org/protobuf/proto" - "time" - "github.com/OpenIMSDK/protocol/constant" pbchat "github.com/OpenIMSDK/protocol/msg" + "github.com/OpenIMSDK/protocol/sdkws" "github.com/OpenIMSDK/tools/errs" "github.com/OpenIMSDK/tools/log" "github.com/OpenIMSDK/tools/mcontext" "github.com/OpenIMSDK/tools/utils" + "google.golang.org/protobuf/proto" cbapi "github.com/openimsdk/open-im-server/v3/pkg/callbackstruct" @@ -188,7 +186,6 @@ func CallbackAfterRevokeMsg(ctx context.Context, req *pbchat.RevokeMsgReq) error ConversationID: req.ConversationID, Seq: req.Seq, UserID: req.UserID, - EventTime: time.Now().Unix(), } resp := &cbapi.CallbackAfterSendGroupMsgResp{} if err := http.CallBackPostReturn(ctx, config.Config.Callback.CallbackUrl, callbackReq, resp, config.Config.Callback.CallbackAfterSetGroupInfo); err != nil { diff --git a/pkg/callbackstruct/friend.go b/pkg/callbackstruct/friend.go index 889d05fe3..7a0cf3b1f 100644 --- a/pkg/callbackstruct/friend.go +++ b/pkg/callbackstruct/friend.go @@ -19,7 +19,6 @@ type CallbackBeforeAddFriendReq struct { FromUserID string `json:"fromUserID" ` ToUserID string `json:"toUserID"` ReqMsg string `json:"reqMsg"` - EventTime int64 `json:"eventTime"` } type CallbackBeforeAddFriendResp struct { @@ -30,7 +29,6 @@ type CallbackAfterAddFriendReq struct { FromUserID string `json:"fromUserID" ` ToUserID string `json:"toUserID"` ReqMsg string `json:"reqMsg"` - EventTime int64 `json:"eventTime"` } type CallbackAfterAddFriendResp struct { @@ -40,7 +38,6 @@ type CallbackBeforeAddBlackReq struct { CallbackCommand `json:"callbackCommand"` OwnerUserID string `json:"ownerUserID" ` BlackUserID string `json:"blackUserID"` - EventTime int64 `json:"eventTime"` } type CallbackBeforeAddBlackResp struct { @@ -51,9 +48,8 @@ type CallbackBeforeAddFriendAgreeReq struct { CallbackCommand `json:"callbackCommand"` FromUserID string `json:"fromUserID" ` ToUserID string `json:"blackUserID"` - HandleResult int32 `json:"HandleResult"'` - HandleMsg string `json:"HandleMsg"'` - EventTime int64 `json:"eventTime"` + HandleResult int32 `json:"HandleResult"` + HandleMsg string `json:"HandleMsg"` } type CallbackBeforeAddFriendAgreeResp struct { @@ -64,7 +60,6 @@ type CallbackAfterDeleteFriendReq struct { CallbackCommand `json:"callbackCommand"` OwnerUserID string `json:"ownerUserID" ` FriendUserID string `json:"friendUserID"` - EventTime int64 `json:"eventTime"` } type CallbackAfterDeleteFriendResp struct { CommonCallbackResp @@ -74,7 +69,6 @@ type CallbackBeforeImportFriendsReq struct { CallbackCommand `json:"callbackCommand"` OwnerUserID string `json:"ownerUserID" ` FriendUserIDs []string `json:"friendUserIDs"` - EventTime int64 `json:"eventTime"` } type CallbackBeforeImportFriendsResp struct { CommonCallbackResp @@ -83,7 +77,6 @@ type CallbackAfterImportFriendsReq struct { CallbackCommand `json:"callbackCommand"` OwnerUserID string `json:"ownerUserID" ` FriendUserIDs []string `json:"friendUserIDs"` - EventTime int64 `json:"eventTime"` } type CallbackAfterImportFriendsResp struct { CommonCallbackResp @@ -92,8 +85,7 @@ type CallbackAfterImportFriendsResp struct { type CallbackAfterRemoveBlackReq struct { CallbackCommand `json:"callbackCommand"` OwnerUserID string `json:"ownerUserID"` - BlackUserID string `json:"blackUserID""` - EventTime int64 `json:"eventTime"` + BlackUserID string `json:"blackUserID"` } type CallbackAfterRemoveBlackResp struct { CommonCallbackResp diff --git a/pkg/callbackstruct/group.go b/pkg/callbackstruct/group.go index 6db92eebe..b2464451a 100644 --- a/pkg/callbackstruct/group.go +++ b/pkg/callbackstruct/group.go @@ -93,7 +93,6 @@ type CallbackBeforeInviteUserToGroupReq struct { GroupID string `json:"groupID"` Reason string `json:"reason"` InvitedUserIDs []string `json:"invitedUserIDs"` - EventTime int64 `json:"eventTime"` } type CallbackBeforeInviteUserToGroupResp struct { CommonCallbackResp @@ -107,7 +106,6 @@ type CallbackAfterJoinGroupReq struct { ReqMessage string `json:"reqMessage"` JoinSource int32 `json:"joinSource"` InviterUserID string `json:"inviterUserID"` - EventTime int64 `json:"eventTime"` } type CallbackAfterJoinGroupResp struct { CommonCallbackResp @@ -125,7 +123,6 @@ type CallbackBeforeSetGroupInfoReq struct { NeedVerification int32 `json:"needVerification"` LookMemberInfo int32 `json:"lookMemberInfo"` ApplyMemberFriend int32 `json:"applyMemberFriend"` - EventTime int64 `json:"eventTime"` } type CallbackBeforeSetGroupInfoResp struct { @@ -153,7 +150,6 @@ type CallbackAfterSetGroupInfoReq struct { NeedVerification *int32 `json:"needVerification"` LookMemberInfo *int32 `json:"lookMemberInfo"` ApplyMemberFriend *int32 `json:"applyMemberFriend"` - EventTime int64 `json:"eventTime"` } type CallbackAfterSetGroupInfoResp struct { diff --git a/pkg/callbackstruct/revoke.go b/pkg/callbackstruct/revoke.go index da7ed4800..364c0162b 100644 --- a/pkg/callbackstruct/revoke.go +++ b/pkg/callbackstruct/revoke.go @@ -5,7 +5,6 @@ type CallbackAfterRevokeMsgReq struct { ConversationID string `json:"conversationID"` Seq int64 `json:"seq"` UserID string `json:"userID"` - EventTime int64 `json:"eventTime"` } type CallbackAfterRevokeMsgResp struct { CommonCallbackResp