Esempio n. 1
0
        public Task SendAsync(IdentityMessage message)
        {
            SmsMessage    msg  = (SmsMessage)message;
            StringBuilder arge = new StringBuilder();

            arge.AppendFormat("Account={0}", "15307000371");
            arge.AppendFormat("&Pwd={0}", "f3cf3ac5c5ffac5b51ff2771f");
            arge.AppendFormat("&Content={0}", msg.Body);
            arge.AppendFormat("&Mobile={0}", msg.Destination);
            arge.AppendFormat("&SignId={0}", 33533);
            arge.AppendFormat("&TemplateId={0}", msg.TemplateId);
            //arge.AppendFormat("&SendTime={0}", request.SendTime);
            string weburl = "http://api.feige.ee/SmsService/Template";
            string resp   = SmsHelper.PushToWeb(weburl, arge.ToString(), Encoding.UTF8);

            // Plug in your sms service here to send a text message.
            try
            {
                SendSmsResponse response = JsonConvert.DeserializeObject <SendSmsResponse>(resp);
                if (response.Code == 0)
                {
                    //成功
                    return(Task.FromResult(0));
                }
                else
                {
                    //失败
                    return(Task.FromResult(0));
                }
            }
            catch (Exception ex)
            {
                //记录日志
                return(Task.FromResult(0));
            }
        }