Merge d244060e594165a7b11e1f13e26d6b79cfbc5160 into b8c4b459fa541205dbdaf32974d63f7ac78b5406

This commit is contained in:
Gagan Singh 2025-11-28 23:39:56 +08:00 committed by GitHub
commit 35907afad8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -152,20 +152,17 @@ func (s *Server) pushToUser(ctx context.Context, userID string, msgData *sdkws.M
userPlatform := &msggateway.SingleMsgToUserPlatform{ userPlatform := &msggateway.SingleMsgToUserPlatform{
RecvPlatFormID: int32(client.PlatformID), RecvPlatFormID: int32(client.PlatformID),
} }
if !client.IsBackground || if client.IsBackground && client.PlatformID == constant.IOSPlatformID {
(client.IsBackground && client.PlatformID != constant.IOSPlatformID) { userPlatform.ResultCode = int64(servererrs.ErrIOSBackgroundPushErr.Code())
err := client.PushMessage(ctx, msgData) result.Resp = append(result.Resp, userPlatform)
if err != nil { continue
}
if err := client.PushMessage(ctx, msgData); err != nil {
log.ZWarn(ctx, "online push msg failed", err, "userID", userID, "platformID", client.PlatformID) log.ZWarn(ctx, "online push msg failed", err, "userID", userID, "platformID", client.PlatformID)
userPlatform.ResultCode = int64(servererrs.ErrPushMsgErr.Code()) userPlatform.ResultCode = int64(servererrs.ErrPushMsgErr.Code())
} else { } else if _, ok := s.pushTerminal[client.PlatformID]; ok {
if _, ok := s.pushTerminal[client.PlatformID]; ok {
result.OnlinePush = true result.OnlinePush = true
} }
}
} else {
userPlatform.ResultCode = int64(servererrs.ErrIOSBackgroundPushErr.Code())
}
result.Resp = append(result.Resp, userPlatform) result.Resp = append(result.Resp, userPlatform)
} }
return result return result