|
|
@ -107,20 +107,17 @@ 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 _, v := range wsResults {
|
|
|
|
// save invitation info for offline push
|
|
|
|
if msg.SendID != v.UserID && (!v.OnlinePush) {
|
|
|
|
for _, v := range wsResults {
|
|
|
|
if err := callbackOfflinePush(ctx, userIDs, msg, &[]string{}); err != nil {
|
|
|
|
if v.OnlinePush {
|
|
|
|
return err
|
|
|
|
return nil
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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)
|
|
|
|
break
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|