fix: user offline push

pull/1015/head
withchao 2 years ago
parent e76ffef473
commit 05e887a78f

@ -108,21 +108,16 @@ func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.Msg
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++
if isOfflinePush { if isOfflinePush {
for _, userID := range userIDs { for _, v := range wsResults {
if userID == msg.SendID { if msg.SendID != v.UserID && (!v.OnlinePush) {
continue if err := callbackOfflinePush(ctx, userIDs, msg, &[]string{}); err != nil {
} return err
for _, v := range wsResults { }
if userID == v.UserID && (!v.OnlinePush) { err = p.offlinePushMsg(ctx, msg.SendID, msg, []string{v.UserID})
if err := callbackOfflinePush(ctx, userIDs, msg, &[]string{}); err != nil { if err != nil {
return err return err
}
err = p.offlinePushMsg(ctx, userID, msg, userIDs)
if err != nil {
return err
}
break
} }
break
} }
} }
} }

Loading…
Cancel
Save