Esempio n. 1
0
        public JPushResult Push(JPushContent content, int receiverType, List <string> receiverValue, int messageType, string platform, int sendId, int?timeToLive, string overrideId)
        {
            JPushResult result = null;

            if (string.IsNullOrWhiteSpace(this._appKey) || string.IsNullOrWhiteSpace(this._masterSecret) || General.IsNullable(receiverValue) || content == null)
            {
                result         = new JPushResult();
                result.Code    = 500;
                result.Message = "关键参数不能为空";
                return(result);
            }

            string receiver = string.Join(",", receiverValue);

            StringBuilder query = new StringBuilder();

            query.AppendFormat(
                "sendno={0}&app_key={1}&receiver_type={2}",
                sendId,
                this._appKey,
                receiverType
                );

            if (receiverType != JPushReceiverType.All)
            {
                query.AppendFormat("&receiver_value={0}", receiver);
            }

            query.AppendFormat(
                "&verification_code={0}&msg_type={1}&msg_content={2}&platform={3}",
                GetVerificationCode(sendId, receiverType, receiver),
                messageType,
                JsonConvert.SerializeObject(content),
                platform
                );

            if (!string.IsNullOrWhiteSpace(this._sendDescription))
            {
                query.AppendFormat("&send_description={0}", this._sendDescription);
            }

            if (timeToLive.HasValue)
            {
                query.AppendFormat("&time_to_live={0}", timeToLive);
            }

            if (!string.IsNullOrWhiteSpace(overrideId))
            {
                query.AppendFormat("&override_msg_id={0}", overrideId);
            }

            result = JPushResult.Parse(
                Submit(this._host, query.ToString())
                );

            return(result);
        }
Esempio n. 2
0
 public JPushResult Push(JPushContent content, List<string> receiverValue)
 {
     return Push(content, this._receiverType, receiverValue, this._msgType, this._platform, this._sendId, this._timeToLive, this._overrideId);
 }
Esempio n. 3
0
 public JPushResult Push(JPushContent content, int receiverType, List<string> receiverValue, int messageType, string platform, int sendId)
 {
     return Push(content, receiverType, receiverValue, messageType, platform, sendId, this._timeToLive, this._overrideId);
 }
Esempio n. 4
0
        public JPushResult Push(JPushContent content, int receiverType, List<string> receiverValue, int messageType, string platform, int sendId, int? timeToLive, string overrideId)
        {
            JPushResult result = null;

            if (string.IsNullOrWhiteSpace(this._appKey) || string.IsNullOrWhiteSpace(this._masterSecret) || General.IsNullable(receiverValue) || content == null)
            {
                result = new JPushResult();
                result.Code = 500;
                result.Message = "关键参数不能为空";
                return result;
            }

            string receiver = string.Join(",", receiverValue);

            StringBuilder query = new StringBuilder();

            query.AppendFormat(
                "sendno={0}&app_key={1}&receiver_type={2}",
                sendId,
                this._appKey,
                receiverType
            );

            if (receiverType != JPushReceiverType.All)
                query.AppendFormat("&receiver_value={0}", receiver);

            query.AppendFormat(
                "&verification_code={0}&msg_type={1}&msg_content={2}&platform={3}",
                GetVerificationCode(sendId, receiverType, receiver),
                messageType,
                JsonConvert.SerializeObject(content),
                platform
            );

            if (!string.IsNullOrWhiteSpace(this._sendDescription))
                query.AppendFormat("&send_description={0}", this._sendDescription);

            if (timeToLive.HasValue)
                query.AppendFormat("&time_to_live={0}", timeToLive);

            if (!string.IsNullOrWhiteSpace(overrideId))
                query.AppendFormat("&override_msg_id={0}", overrideId);

            result = JPushResult.Parse(
                Submit(this._host, query.ToString())
            );

            return result;
        }
Esempio n. 5
0
 public JPushResult Push(JPushContent content, List <string> receiverValue)
 {
     return(Push(content, this._receiverType, receiverValue, this._msgType, this._platform, this._sendId, this._timeToLive, this._overrideId));
 }
Esempio n. 6
0
 public JPushResult Push(JPushContent content, int receiverType, List <string> receiverValue, int messageType, string platform, int sendId)
 {
     return(Push(content, receiverType, receiverValue, messageType, platform, sendId, this._timeToLive, this._overrideId));
 }