Exemplo n.º 1
0
        //推送标签,ios设备使用
        public string PushTags(List <string> tagList, string tagOp, MessageIOS message, int environment)
        {
            if (!isValidMessageType(message, environment))
            {
                return("{'ret_code':-1,'err_msg':'message type or environment error!'}");
            }
            if (!message.isValid())
            {
                return("{'ret_code':-1,'err_msg':'message invalid!'}");
            }
            Dictionary <string, object> param = new Dictionary <string, object>();

            param.Add("access_id", this.m_accessId);
            param.Add("expire_time", message.getExpireTime());
            param.Add("send_time", message.getSendTime());
            param.Add("message_type", message.getType());
            param.Add("tags_list", toJArray(tagList));
            param.Add("tags_op", tagOp);
            param.Add("message", message.toJson());
            param.Add("timestamp", (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000);
            param.Add("environment", environment);
            if (message.getLoopInterval() > 0 && message.getLoopTimes() > 0)
            {
                param.Add("loop_interval", message.getLoopInterval());
                param.Add("loop_times", message.getLoopTimes());
            }
            string ret = callRestful(XingeApp.RESTAPI_PUSHTAGS, param);

            return(ret);
        }
Exemplo n.º 2
0
        //推送单个设备,ios设备使用,IOSENV_PROD表示生产环境,IOSENV_DEV表示开发环境
        public string PushSingleDevice(string deviceToken, MessageIOS message, int environment)
        {
            if (!isValidMessageType(message, environment))
            {
                return("{'ret_code':-1,'err_msg':'message type or environment error!'}");
            }
            if (!message.isValid())
            {
                return("{'ret_code':-1,'err_msg':'message invalid!'}");
            }
            Dictionary <string, object> param = new Dictionary <string, object>();

            param.Add("access_id", this.m_accessId);
            param.Add("expire_time", message.getExpireTime());
            param.Add("send_time", message.getSendTime());
            param.Add("device_token", deviceToken);
            param.Add("message_type", message.getType());
            param.Add("message", message.toJson());
            param.Add("timestamp", (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000);
            param.Add("environment", environment);
            if (message.getLoopInterval() > 0 && message.getLoopTimes() > 0)
            {
                param.Add("loop_interval", message.getLoopInterval());
                param.Add("loop_times", message.getLoopTimes());
            }
            string ret = callRestful(XingeApp.RESTAPI_PUSHSINGLEDEVICE, param);

            return(ret);
        }
Exemplo n.º 3
0
        //创建批量推送消息,后续利用生成的pushid配合PushAccountListMultiple或PushDeviceListMultiple接口使用,限ios
        public string CreateMultipush(MessageIOS message, int environment)
        {
            if (!isValidMessageType(message, environment))
            {
                return("{'ret_code':-1,'err_msg':'message type or environment error!'}");
            }
            if (!message.isValid())
            {
                return("{'ret_code':-1,'err_msg':'message invalid!'}");
            }
            Dictionary <string, object> param = new Dictionary <string, object>();

            param.Add("access_id", this.m_accessId);
            param.Add("expire_time", message.getExpireTime());
            param.Add("message_type", message.getType());
            param.Add("message", message.toJson());
            param.Add("timestamp", (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000);
            param.Add("environment", environment);
            string ret = callRestful(XingeApp.RESTAPI_CREATEMULTIPUSH, param);

            return(ret);
        }
Exemplo n.º 4
0
        //推送账号列表,ios设备使用
        public string PushAccountList(List <string> accountList, MessageIOS message, int environment)
        {
            if (!isValidMessageType(message, environment))
            {
                return("{'ret_code':-1,'err_msg':'message type or environment error!'}");
            }
            if (!message.isValid())
            {
                return("{'ret_code':-1,'err_msg':'message invalid!'}");
            }
            Dictionary <string, object> param = new Dictionary <string, object>();

            param.Add("access_id", this.m_accessId);
            param.Add("expire_time", message.getExpireTime());
            param.Add("send_time", message.getSendTime());
            param.Add("account_list", toJArray(accountList));
            param.Add("message_type", message.getType());
            param.Add("message", message.toJson());
            param.Add("timestamp", (DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000000);
            param.Add("environment", environment);
            string ret = callRestful(XingeApp.RESTAPI_PUSHACCOUNTLIST, param);

            return(ret);
        }