예제 #1
0
        /// <summary>
        /// 通过多个设备号发送ios推送
        /// </summary>
        /// <param name="reqModel"></param>
        /// <returns></returns>
        public static bool PushNotoficationByDeviceTokens(UMengSendMsgModel reqModel)
        {
            UMengPushModel iosModel = IOSModelInit(reqModel);

            UMengTools.InitPushModelByDeviceTokens(iosModel, reqModel.DeviceTokens, EquipmentTypeEnum.IOS);
            UMengResponseModel model = UMengTools.UMengPostRequest(UMengUrlList.ApiSend, EquipmentTypeEnum.IOS, iosModel);

            return(model != null && model.ret.Equals("SUCCESS"));
        }
예제 #2
0
        /// <summary>
        /// 调用文件上传接口,获取file_id
        /// </summary>
        /// <param name="appkey"></param>
        /// <param name="deviceTokens"></param>
        /// <param name="equipmentType"></param>
        /// <returns></returns>
        private static UMengResponseModel Upload(string appkey, List <string> deviceTokens, EquipmentTypeEnum equipmentType)
        {
            UMengUploadRequestModel model = new UMengUploadRequestModel();

            model.appkey    = appkey;
            model.timestamp = GetTimeStamp();
            model.content   = string.Join("\n", deviceTokens.ToArray()) + "\n";
            return(UMengTools.UMengPostRequest(UMengUrlList.ApiUpload, equipmentType, model));
        }
예제 #3
0
        /// <summary>
        /// 通过多个用户发送ios推送
        /// </summary>
        /// <param name="reqModel"></param>
        /// <returns></returns>
        public static bool PushNotoficationByUsers(UMengSendMsgModel reqModel)
        {
            UMengPushModel iosModel = IOSModelInit(reqModel);

            UMengTools.InitPushModelByUsers(iosModel, reqModel.DeviceTokens, EquipmentTypeEnum.IOS);
            UMengResponseModel model = UMengTools.UMengPostRequest(UMengUrlList.ApiSend, EquipmentTypeEnum.IOS, iosModel);

            //2010:与alias对应的device_tokens为空
            //在单播的时候,如果安卓的用户推送给IOS设备,则会返回2010错误
            return(model != null && (model.ret.Equals("SUCCESS") || model.data.error_code == "2010"));
        }