Esempio n. 1
0
        /// <summary>
        /// 删除短信模板。
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public Task <SmsResult> DeleteSmsTemplateAsync(DeleteSmsTemplateInput input)
        {
            var client    = new AliyunSmsClient();
            var acsClient = client.AcsClient;
            var request   = new DeleteSmsTemplateRequest();
            var result    = new SmsResult();

            try
            {
                request.TemplateCode = input.TemplateCode;
                //请求失败这里会抛ClientException异常
                var DeleteSmsTemplateResponse = acsClient.GetAcsResponse(request);
                //发送成功判断
                if ("OK".Equals(DeleteSmsTemplateResponse.Code, StringComparison.CurrentCultureIgnoreCase))
                {
                    result.Success = true;
                }
                else
                {
                    result.Success      = false;
                    result.ErrorMessage = DeleteSmsTemplateResponse.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));
        }
 /// <summary>
 /// 删除短信模板。
 /// </summary>
 /// <param name="input"></param>
 /// <returns></returns>
 public async Task <SmsResult> DeleteSmsTemplateAsync(DeleteSmsTemplateInput input)
 {
     return(await SmsService.DeleteSmsTemplateAsync(input));
 }