fix: user offline push

pull/1015/head
withchao 2 years ago
parent e0d01aa6ce
commit e76ffef473

@ -107,14 +107,13 @@ func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.Msg
isOfflinePush := utils.GetSwitchFromOptions(msg.Options, constant.IsOfflinePush)
log.ZDebug(ctx, "push_result", "ws push result", wsResults, "sendData", msg, "isOfflinePush", isOfflinePush, "push_to_userID", userIDs)
p.successCount++
if isOfflinePush {
for _, userID := range userIDs {
if isOfflinePush && userID != msg.SendID {
// save invitation info for offline push
for _, v := range wsResults {
if v.OnlinePush {
return nil
}
if userID == msg.SendID {
continue
}
for _, v := range wsResults {
if userID == v.UserID && (!v.OnlinePush) {
if err := callbackOfflinePush(ctx, userIDs, msg, &[]string{}); err != nil {
return err
}
@ -122,6 +121,9 @@ func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.Msg
if err != nil {
return err
}
break
}
}
}
}
return nil

Loading…
Cancel
Save