Пример #1
0
        /// <summary>
        /// 获取推送目标
        /// </summary>
        private Audience GetAudience()
        {
            Audience audience = null;

            switch (PushModel.Audience.Category)
            {
            // 标签
            case PushAudienceCategory.Tags:
                audience = Audience.s_tag(PushModel.Audience.Objects.ToArray());
                break;

            // 别名
            case PushAudienceCategory.Alias:
                audience = Audience.s_alias(PushModel.Audience.Objects.ToArray());
                break;

            // RegistrationID
            case PushAudienceCategory.RegistrationID:
                audience = Audience.s_registrationId(PushModel.Audience.Objects.ToArray());
                break;

            // 群组,暂未支持
            case PushAudienceCategory.UserGroup:
                return(null);

            // 广播
            default:
                return(Audience.all());
            }

            if (PushModel.Audience.SecondObjects != null && PushModel.Audience.SecondObjects.Objects.Count > 0)
            {
                // 二级关联取交集
                if (PushModel.Audience.SecondObjects.Category == PushAudienceSecondCategory.TagsAnd)
                {
                    audience.tag_and(PushModel.Audience.SecondObjects.Objects.ToArray());
                }

                // 二级关联取非,当前SDK暂不支持
                //if (PushModel.Audience.SecondObjects.Category == PushAudienceSecondCategory.TagsNot)
                //{

                //}
            }
            return(audience);
        }