예제 #1
0
        public override string Push()
        {
            string pushResult;
            var    message = new SingleMessage
            {
                Data              = GeTui.ToTemplate(PhoneType, TemplateType),
                IsOffline         = true,             // 用户当前不在线时,是否离线存储,可选
                OfflineExpireTime = 1000 * 3600 * 12, // 离线有效时间,单位为毫秒,可选
                PushNetWorkType   = 0                 //判断是否客户端是否wifi环境下推送,1为在WIFI环境下,0为不限制网络环境。
            };
            var target = new Target
            {
                appId    = ConfigSettings.AppId,
                clientId = GeTui.ClientId
            };

            try
            {
                pushResult = pushMessageToSingle(message, target);
            }
            catch (RequestException ex)
            {
                var requestId = ex.RequestId;
                pushResult = pushMessageToSingle(message, target, requestId);//发送失败后的重发
            }

            return(pushResult);
        }
예제 #2
0
        public override string Push()
        {
            var message = new SingleMessage
            {
                Data              = GeTui.ToTemplate(PhoneType, TemplateType),
                IsOffline         = true,             // 用户当前不在线时,是否离线存储,可选
                OfflineExpireTime = 1000 * 3600 * 12, // 离线有效时间,单位为毫秒,可选
                PushNetWorkType   = 0                 //判断是否客户端是否wifi环境下推送,1为在WIFI环境下,0为不限制网络环境。
            };
            var batch = new BatchImpl(ConfigSettings.AppKey, this);

            foreach (var cid in GeTui.ClientId.Split(','))
            {
                var target = new Target
                {
                    appId    = ConfigSettings.AppId,
                    clientId = cid
                };
                batch.add(message, target);
            }
            try
            {
                return(batch.submit());
            }
            catch (Exception)
            {
                return(batch.retry());
            }
        }
예제 #3
0
 public MessageToSinglePush(PhoneType phoneType, TemplateType templateType, GeTui geTui) : base(phoneType, templateType, geTui)
 {
 }
예제 #4
0
 public SingleBatchPush(PhoneType phoneType, TemplateType templateType, GeTui geTui) : base(phoneType, templateType, geTui)
 {
 }