mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-03 02:42:19 +08:00
fix push online and offline user, but why typing trigger callback push?
This commit is contained in:
parent
e31c6c2ce8
commit
75414a52f8
@ -101,10 +101,6 @@ func (p *Pusher) DeleteMemberAndSetConversationSeq(ctx context.Context, groupID
|
|||||||
|
|
||||||
func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.MsgData) error {
|
func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.MsgData) error {
|
||||||
log.ZDebug(ctx, "Get msg from msg_transfer And push msg", "userIDs", userIDs, "msg", msg.String())
|
log.ZDebug(ctx, "Get msg from msg_transfer And push msg", "userIDs", userIDs, "msg", msg.String())
|
||||||
// callback
|
|
||||||
if err := callbackOnlinePush(ctx, userIDs, msg); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
// push
|
// push
|
||||||
wsResults, err := p.GetConnsAndOnlinePush(ctx, msg, userIDs)
|
wsResults, err := p.GetConnsAndOnlinePush(ctx, msg, userIDs)
|
||||||
@ -120,7 +116,11 @@ func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.Msg
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range wsResults {
|
for _, v := range wsResults {
|
||||||
if msg.SendID != v.UserID && (!v.OnlinePush) {
|
if msg.SendID == v.UserID {
|
||||||
|
continue // Skip if sender and receiver are the same
|
||||||
|
}
|
||||||
|
|
||||||
|
if !v.OnlinePush {
|
||||||
if err = callbackOfflinePush(ctx, userIDs, msg, &[]string{}); err != nil {
|
if err = callbackOfflinePush(ctx, userIDs, msg, &[]string{}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -129,7 +129,12 @@ func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.Msg
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if err := callbackOnlinePush(ctx, userIDs, msg); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user