diff --git a/internal/push/getui/push.go b/internal/push/getui/push.go index fd4efaaa8..03d3346ce 100644 --- a/internal/push/getui/push.go +++ b/internal/push/getui/push.go @@ -1,7 +1,7 @@ package getui import ( - "Open_IM/internal/push/logic" + "Open_IM/internal/push" "Open_IM/pkg/common/config" "Open_IM/pkg/common/db" "Open_IM/pkg/common/log" @@ -99,7 +99,7 @@ func newGetuiClient() *Getui { return &Getui{} } -func (g *Getui) Push(userIDList []string, alert, detailContent, operationID string, opts logic.PushOpts) (resp string, err error) { +func (g *Getui) Push(userIDList []string, alert, detailContent, operationID string, opts push.PushOpts) (resp string, err error) { token, err := db.DB.GetGetuiToken() log.NewDebug(operationID, utils.GetSelfFuncName(), "token:", token) if err != nil { diff --git a/internal/push/jpush/push.go b/internal/push/jpush/push.go index 8868c9616..01f827753 100644 --- a/internal/push/jpush/push.go +++ b/internal/push/jpush/push.go @@ -1,9 +1,9 @@ package push import ( + "Open_IM/internal/push" "Open_IM/internal/push/jpush/common" "Open_IM/internal/push/jpush/requestBody" - "Open_IM/internal/push/logic" "Open_IM/pkg/common/config" "bytes" "encoding/json" @@ -33,7 +33,7 @@ func (j *JPush) SetAlias(cid, alias string) (resp string, err error) { return resp, nil } -func (j *JPush) Push(accounts []string, alert, detailContent, operationID string, opts logic.PushOpts) (string, error) { +func (j *JPush) Push(accounts []string, alert, detailContent, operationID string, opts push.PushOpts) (string, error) { var pf requestBody.Platform pf.SetAll() var au requestBody.Audience diff --git a/internal/push/logic/push_to_client.go b/internal/push/logic/push_to_client.go index 5584c8d21..1085208d8 100644 --- a/internal/push/logic/push_to_client.go +++ b/internal/push/logic/push_to_client.go @@ -7,6 +7,7 @@ package logic import ( + "Open_IM/internal/push" "Open_IM/pkg/common/config" "Open_IM/pkg/common/constant" "Open_IM/pkg/common/log" @@ -36,14 +37,6 @@ type AtContent struct { var grpcCons []*grpc.ClientConn -type PushOpts struct { - Signal Signal -} - -type Signal struct { - ClientMsgID string -} - func MsgToUser(pushMsg *pbPush.PushMsgReq) { var wsResult []*pbRelay.SingleMsgToUser isOfflinePush := utils.GetSwitchFromOptions(pushMsg.MsgData.Options, constant.IsOfflinePush) @@ -146,7 +139,7 @@ func MsgToUser(pushMsg *pbPush.PushMsgReq) { } } -func GetOfflinePushOpts(pushMsg *pbPush.PushMsgReq) (opts PushOpts, err error) { +func GetOfflinePushOpts(pushMsg *pbPush.PushMsgReq) (opts push.PushOpts, err error) { if pushMsg.MsgData.ContentType < constant.SignalingNotificationEnd && pushMsg.MsgData.ContentType > constant.SignalingNotification { req := &pbRtc.SignalMessageAssembleReq{} if err := proto.Unmarshal(pushMsg.MsgData.Content, req); err != nil { diff --git a/internal/push/push_interface.go b/internal/push/push_interface.go index cc6e25271..a1d45d7b7 100644 --- a/internal/push/push_interface.go +++ b/internal/push/push_interface.go @@ -1,7 +1,13 @@ package push -import "Open_IM/internal/push/logic" - type OfflinePusher interface { - Push(userIDList []string, alert, detailContent, operationID string, opts logic.PushOpts) (resp string, err error) + Push(userIDList []string, alert, detailContent, operationID string, opts PushOpts) (resp string, err error) +} + +type PushOpts struct { + Signal Signal +} + +type Signal struct { + ClientMsgID string }