• C#阿里云移动推送列表


      C#阿里云移动推送列表

    这个就在上期随笔的基础之上,加一个 函数就行了。   简单的。

    附上源码:一下代码只要把参数改一下就可以了,中间几个参数 可以灵活修改

            /// <summary>
            /// 获取移动消息列表
            /// </summary>
            public static void GetPushList()
            {
                IClientProfile clientProfile = DefaultProfile.GetProfile("cn-hangzhou", AliyunConfig.AccessId, AliyunConfig.AccessSecret);
                DefaultAcsClient client = new DefaultAcsClient(clientProfile);
                ListPushRecordsRequest request = new ListPushRecordsRequest();
                request.AppKey = AliyunConfig.AppKeyIOS;// 设备区分
                request.PushType = "NOTICE";//推送区分
                String startTime = DateTime.UtcNow.AddDays(-7).ToString("yyyy-MM-ddTHH\:mm\:ssZ"); //查询近期天的数据
                String endTime = DateTime.UtcNow.ToString("yyyy-MM-ddTHH\:mm\:ssZ");
                request.StartTime = startTime;
                request.EndTime = endTime;
                request.Page = 1;
                request.PageSize = 10;
                try
                {
                    ListPushRecordsResponse response = client.GetAcsResponse(request);
                    Console.WriteLine("RequestId:" + response.RequestId);
                    int? count = response.Total;
    
                    foreach (ListPushRecordsResponse.ListPushRecords_PushMessageInfo stat in response.PushMessageInfos)
                    {
                        Console.WriteLine("MessageId:" + stat.MessageId);
                        Console.WriteLine("Type:" + stat.Type);
                        Console.WriteLine("DeviceType:" + stat.DeviceType);
                        Console.WriteLine("PushTime:" + stat.PushTime);
                        Console.WriteLine("Title:" + stat.Title);
                        Console.WriteLine("Body:" + stat.Body);
                    }
                    Console.ReadLine();
                }
                catch (ServerException ex)
                {
                    Console.WriteLine(ex.ErrorCode);
                    Console.WriteLine(ex.ErrorMessage);
                    Console.ReadLine();
                }
                catch (ClientException ex)
                {
                    Console.WriteLine(ex.ErrorCode);
                    Console.WriteLine(ex.ErrorMessage);
                    Console.ReadLine();
                }
            }
  • 相关阅读:
    【RabbitMQ】10 深入部分P3 死信队列(交换机)
    【RabbitMQ】09 深入部分P2 消费限流 & TTL
    【RabbitMQ】08 深入部分P1 可靠性投递
    【RabbitMQ】06 Spring整合RabbitMQ
    【RabbitMQ】07 SpringBoot整合RabbitMQ
    【RabbitMQ】05 通配符模式
    【RabbitMQ】04 路由模式
    【RabbitMQ】03 订阅模式
    【RabbitMQ】02 工作队列模式
    【RabbitMQ】01 简单模式
  • 原文地址:https://www.cnblogs.com/longm/p/9627624.html
Copyright © 2020-2023  润新知