public static string querySendDetailsByMobile(string mobile)
        {
            //初始化acsClient,暂不支持region化
            IClientProfile profile = DefaultProfile.GetProfile("cn-hangzhou", accessKeyId, accessKeySecret);

            DefaultProfile.AddEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
            IAcsClient acsClient = new DefaultAcsClient(profile);
            //组装请求对象
            QuerySendDetailsRequest request = new QuerySendDetailsRequest();

            //必填-号码
            request.PhoneNumber = mobile;
            //可选-流水号
            // request.BizId = bizId;
            //必填-发送日期 支持30天内记录查询,格式yyyyMMdd
            request.SendDate = DateTime.Now.ToString("yyyyMMdd");
            //必填-页大小
            request.PageSize = 10;
            //必填-当前页码从1开始计数
            request.CurrentPage = 1;
            QuerySendDetailsResponse querySendDetailsResponse = null;

            try
            {
                querySendDetailsResponse = acsClient.GetAcsResponse(request);
            }
            catch (ServerException e)
            {
                return("查询出错!");
            }
            string json = "";

            json = "{\"data\":\"" + querySendDetailsResponse.SmsSendDetailDTOs[0].Content + "\"}";
            return(json);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 短信发送查询
        /// </summary>
        /// <param name="phone">发送手机号</param>
        /// <param name="bizid">业务编号</param>
        static void QuerySendDetails(string phone, string bizid)
        {
            IClientProfile          profile = DefaultProfile.GetProfile("cn-hangzhou", _accessKey, _accessSecret);
            IAcsClient              client  = new DefaultAcsClient(profile);
            QuerySendDetailsRequest request = new QuerySendDetailsRequest();

            try
            {
                request.PhoneNumber = phone;
                request.BizId       = bizid;
                request.SendDate    = DateTime.Now.ToString("yyyyMMdd");
                request.PageSize    = 10L;
                request.CurrentPage = 1L;
                QuerySendDetailsResponse httpResponse = client.GetAcsResponse(request);
                Console.WriteLine(httpResponse.Code);
            }
            catch (ServerException e)
            {
                Console.WriteLine(e.ErrorCode);
                Console.WriteLine(e.ErrorMessage);
            }
            catch (ClientException e)
            {
                Console.WriteLine(e.ErrorCode);
                Console.WriteLine(e.ErrorMessage);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 查询发送记录
        /// </summary>
        /// <param name="bizId"></param>
        /// <returns></returns>
        public QuerySendDetailsResponse querySendDetails(YaeherSendMsm sendMsmInfo)
        {
            //初始化acsClient,暂不支持region化
            IClientProfile profile = DefaultProfile.GetProfile("cn-hangzhou", accessKeyId, accessKeySecret);

            DefaultProfile.AddEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
            IAcsClient acsClient = new DefaultAcsClient(profile);
            //组装请求对象
            QuerySendDetailsRequest request = new QuerySendDetailsRequest();

            //必填-号码
            request.PhoneNumber = sendMsmInfo.PhoneNumbers;
            //必填-发送日期 支持30天内记录查询,格式yyyyMMdd
            request.SendDate = DateTime.Now.ToString("yyyyMMdd");
            //必填-页大小
            request.PageSize = 10;
            //必填-当前页码从1开始计数
            request.CurrentPage = 1;
            QuerySendDetailsResponse querySendDetailsResponse = null;

            try
            {
                querySendDetailsResponse = acsClient.GetAcsResponse(request);
            }
            catch (ServerException e)
            {
                throw e;
            }
            catch (ClientException e)
            {
                throw e;
            }
            return(querySendDetailsResponse);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 短信查询
        /// </summary>
        /// <param name="phoneNumber">手机号</param>
        /// <param name="SMSCode">验证码</param>
        public static string querySendDetails(string phoneNumber)
        {
            //初始化acsClient,暂不支持region化
            IClientProfile profile = DefaultProfile.GetProfile("cn-hangzhou", accessKeyId, accessKeySeret);

            DefaultProfile.AddEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
            IAcsClient acsClient = new DefaultAcsClient(profile);
            //组装请求对象
            QuerySendDetailsRequest request = new QuerySendDetailsRequest();

            //必填-号码
            request.PhoneNumber = phoneNumber;
            //可选-流水号
            //request.BizId = bizId;
            //必填-发送日期 支持30天内记录查询,格式yyyyMMdd
            request.SendDate = DateTime.Now.ToString("yyyyMMdd");
            //必填-页大小
            request.PageSize = 10;
            //必填-当前页码从1开始计数
            request.CurrentPage = 1;
            QuerySendDetailsResponse querySendDetailsResponse = null;

            try
            {
                querySendDetailsResponse = acsClient.GetAcsResponse(request);
            }
            catch (ServerException e)
            {
            }
            catch (ClientException e)
            {
            }
            return(querySendDetailsResponse.TotalCount);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 短信发送记录查询接口
        /// 用于查询短信发送的状态,是否成功到达终端用户手机
        /// </summary>
        /// <param name="phone">手机号</param>
        /// <param name="bizId">发送流水号,从调用发送接口返回值中获取</param>
        /// <param name="date">短信发送日期格式yyyyMMdd,支持最近30天记录查询</param>
        /// <param name="currentPage">当前页码</param>
        /// <returns></returns>
        public QuerySendDetailsResponse QuerySendDetails(string phone, string bizId, DateTime date, int currentPage = 1)
        {
            //初始化acsClient,暂不支持region化
            IClientProfile profile = DefaultProfile.GetProfile("cn-hangzhou", AccessKeyId, AccessKeySecret);

            DefaultProfile.AddEndpoint("cn-hangzhou", "cn-hangzhou", Product, Domain);
            IAcsClient acsClient = new DefaultAcsClient(profile);
            //组装请求对象
            var request = new QuerySendDetailsRequest();

            //必填-号码
            request.PhoneNumber = phone;
            //可选-流水号
            request.BizId = bizId;
            //必填-发送日期 支持30天内记录查询,格式yyyyMMdd
            request.SendDate = date.ToString("yyyyMMdd");
            //必填-页大小
            request.PageSize = 50;
            //必填-当前页码从1开始计数
            request.CurrentPage = currentPage;
            QuerySendDetailsResponse querySendDetailsResponse = null;

            try
            {
                querySendDetailsResponse = acsClient.GetAcsResponse(request);
            }
            catch (ServerException)
            {
            }
            catch (ClientException)
            {
            }
            return(querySendDetailsResponse);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 查看短信发送记录和发送状态。
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public Task <QuerySendDetailsResponse> QuerySendDetails(AliyunSmsQuerySendDetailsInput input)
        {
            var request = new QuerySendDetailsRequest
            {
                PhoneNumber = input.Mobile,
                SendDate    = input.SendDate.ToString("yyyyMMDD"),
                PageSize    = input.PageSize,
                CurrentPage = input.CurrentPage
            };

            var rsp = AcsClient.GetAcsResponse(request);

            return(Task.FromResult(rsp));
        }
Ejemplo n.º 7
0
                           QuerySendDetailsResponseBodySmsSendDetailDTOsSmsSendDetailDTO> > QuerySendDetailsAsync(string bizId,
                                                                                                                  string phoneNumber, int pageIndex, int pageSize)
        {
            var queryRequest = new QuerySendDetailsRequest
            {
                PhoneNumber = AlibabaCloud.TeaUtil.Common.AssertAsString(phoneNumber),
                BizId       = bizId,
                SendDate    = AlibabaCloud.DarabonbaTime.Time.Format("yyyyMMdd"),
                CurrentPage = pageIndex,
                PageSize    = pageSize
            };
            var queryResponse = await _client.QuerySendDetailsAsync(queryRequest);

            return(queryResponse.Body.SmsSendDetailDTOs.SmsSendDetailDTO);
        }
Ejemplo n.º 8
0
        public async Task Should_Return_Code_OK()
        {
            // Arrange
            var request = new QuerySendDetailsRequest(AbpAliyunSmsTestsConsts.TargetPhoneNumber,
                                                      "20190801",
                                                      20,
                                                      1);

            // Act
            var result = await AliyunApiRequester.SendRequestAsync <QuerySendDetailsResponse>(request,
                                                                                              AbpAliyunSmsOptions.EndPoint);

            // Assert
            result.ShouldNotBeNull();
            result.Code.ShouldBe("OK");
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 查看短信发送记录和发送状态。
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public Task <QuerySendDetailsResult> QuerySendDetailsAsync(QuerySendDetailsInput input)
        {
            var client    = new AliyunSmsClient();
            var acsClient = client.AcsClient;
            var request   = new QuerySendDetailsRequest();
            var result    = new QuerySendDetailsResult();

            try
            {
                request.PhoneNumber = input.PhoneNumber;
                request.SendDate    = input.SendDate.ToString("yyyyMMDD");
                request.PageSize    = input.PageSize;
                request.CurrentPage = input.CurrentPage;

                //请求失败这里会抛ClientException异常
                var querySendDetailsResponse = acsClient.GetAcsResponse(request);
                //发送成功判断
                if ("OK".Equals(querySendDetailsResponse.Code, StringComparison.CurrentCultureIgnoreCase))
                {
                    result.Success           = true;
                    result.SmsSendDetailDTOs = querySendDetailsResponse.SmsSendDetailDTOs;
                }
                else
                {
                    result.Success      = false;
                    result.ErrorMessage = querySendDetailsResponse.Message;
                }
            }
            catch (ClientException e)
            {
                AliyunSmsHelper.LoggerAction("Error", e.ToString());
                result.Success      = false;
                result.ErrorMessage = e.ErrorMessage;
            }
            catch (Exception e)
            {
                AliyunSmsHelper.LoggerAction("Error", e.ToString());
                result.Success      = false;
                result.ErrorMessage = e.Message;
            }
            return(Task.FromResult(result));
        }
Ejemplo n.º 10
0
    /// <summary>
    /// 查询SMS发送信息详情
    /// </summary>
    /// <param name="PhoneNumber"></param>
    /// <param name="bizId"></param>
    /// <param name="SendDate"></param>
    /// <returns></returns>
    public static QuerySendDetailsResponse QuerySendDetails(String PhoneNumber, String bizId, String SendDate)
    {
        //初始化acsClient,暂不支持region化
        IClientProfile profile = DefaultProfile.GetProfile("cn-hangzhou", accessKeyId, accessKeySecret);

        DefaultProfile.AddEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
        IAcsClient acsClient = new DefaultAcsClient(profile);
        //组装请求对象
        QuerySendDetailsRequest request = new QuerySendDetailsRequest();

        //必填-号码
        //request.PhoneNumber = "15000000000";
        request.PhoneNumber = PhoneNumber;
        //可选-流水号
        request.BizId = bizId;
        //必填-发送日期 支持30天内记录查询,格式yyyyMMdd
        //request.SendDate = DateTime.Now.ToString("yyyyMMdd");
        request.SendDate = SendDate;
        //必填-页大小
        request.PageSize = 10;
        //必填-当前页码从1开始计数
        request.CurrentPage = 1;

        QuerySendDetailsResponse querySendDetailsResponse = null;

        try
        {
            querySendDetailsResponse = acsClient.GetAcsResponse(request);
        }
        catch (ServerException e)
        {
            Debug.LogErrorFormat("ServerException:{0}", e.ErrorCode);
        }
        catch (ClientException e)
        {
            Debug.LogErrorFormat("ClientException:{0}", e.ErrorCode);
        }
        return(querySendDetailsResponse);
    }
Ejemplo n.º 11
0
        /// <summary>
        /// 查询发送情况
        /// </summary>
        /// <param name="phone"></param>
        /// <param name="bizId"></param>
        /// <returns></returns>
        private QuerySendDetailsResponse QuerySendDetails(string phone, string bizId)
        {
            //初始化acsClient,暂不支持region化
            IClientProfile profile = DefaultProfile.GetProfile("cn-hangzhou", AccessKeyId, AccessKeySecret);

            DefaultProfile.AddEndpoint("cn-hangzhou", "cn-hangzhou", Product, Domain);
            IAcsClient acsClient = new DefaultAcsClient(profile);
            //组装请求对象
            QuerySendDetailsRequest request = new QuerySendDetailsRequest();

            //必填-号码
            request.PhoneNumber = phone;
            //可选-流水号
            request.BizId = bizId;
            //必填-发送日期 支持30天内记录查询,格式yyyyMMdd
            request.SendDate = DateTime.Now.ToString("yyyyMMdd");
            //必填-页大小
            request.PageSize = 10;
            //必填-当前页码从1开始计数
            request.CurrentPage = 1;

            QuerySendDetailsResponse querySendDetailsResponse = null;

            try
            {
                querySendDetailsResponse = acsClient.GetAcsResponse(request);
            }
            catch (Aliyun.Acs.Core.Exceptions.ServerException e)
            {
                Console.WriteLine(e.ErrorCode);
            }
            catch (ClientException e)
            {
                Console.WriteLine(e.ErrorCode);
            }
            return(querySendDetailsResponse);
        }
Ejemplo n.º 12
0
    public static QuerySendDetailsResponse querySendDetails(String bizId)
    {
        //初始化acsClient,暂不支持region�?
        IClientProfile profile = DefaultProfile.GetProfile("cn-hangzhou", accessKeyId, accessKeySecret);

        DefaultProfile.AddEndpoint("cn-hangzhou", "cn-hangzhou", product, domain);
        IAcsClient acsClient = new DefaultAcsClient(profile);
        //组装请求对象
        QuerySendDetailsRequest request = new QuerySendDetailsRequest();

        //必填-号码
        request.PhoneNumber = "15000000000";
        //可�??-流水�?
        request.BizId = bizId;
        //必填-发�?�日�? 支持30天内记录查询,格式yyyyMMdd
        request.SendDate = DateTime.Now.ToString("yyyyMMdd");
        //必填-页大�?
        request.PageSize = 10;
        //必填-当前页码�?1�?始计�?
        request.CurrentPage = 1;

        QuerySendDetailsResponse querySendDetailsResponse = null;

        try
        {
            querySendDetailsResponse = acsClient.GetAcsResponse(request);
        }
        catch (ServerException e)
        {
            Console.WriteLine(e.ErrorCode);
        }
        catch (ClientException e)
        {
            Console.WriteLine(e.ErrorCode);
        }
        return(querySendDetailsResponse);
    }
Ejemplo n.º 13
0
 public async Task <QuerySendDetailsResponse> QuerySendDetailsAsync(QuerySendDetailsRequest request)
 {
     AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions();
     return(await QuerySendDetailsWithOptionsAsync(request, runtime));
 }
Ejemplo n.º 14
0
 public QuerySendDetailsResponse QuerySendDetails(QuerySendDetailsRequest request)
 {
     AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime = new AlibabaCloud.TeaUtil.Models.RuntimeOptions();
     return(QuerySendDetailsWithOptions(request, runtime));
 }
Ejemplo n.º 15
0
 public async Task <QuerySendDetailsResponse> QuerySendDetailsWithOptionsAsync(QuerySendDetailsRequest request, AlibabaCloud.TeaUtil.Models.RuntimeOptions runtime)
 {
     AlibabaCloud.TeaUtil.Common.ValidateModel(request);
     return(TeaModel.ToObject <QuerySendDetailsResponse>(await DoRequestAsync("QuerySendDetails", "HTTPS", "POST", "2017-05-25", "AK", null, request.ToMap(), runtime)));
 }