fix: user offline push

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

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

Loading…
Cancel
Save