Beispiel #1
0
 public void SendSMS(string[] telephones, string downSendOrderCode, string[] smsParameters, string tenantCode, ConsumeType type)
 {
     try
     {
         string smsContent = this.GetSMSContentByDownSendOrder(downSendOrderCode, smsParameters);
         SMSService serv = new SMSService();
         foreach (var tel in telephones)
         {
             try
             {
                 serv.SendSMS(tenantCode, smsContent, tel, type);
             }
             catch (System.Net.WebException ex)
             {
                 Logger.Error(ex.Message);
             }
             catch (Exception ex)
             {
                 Logger.Error(ex.Message);
             }
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex.Message);
     }
 }
Beispiel #2
0
        public bool Get_MobileSMSSendOut(string mobile, string userCode, string sendMsg, out string msg)
        {
            bool isOk = false;
            msg = "短信已发送,请注意查收!";
            SMSService smsService = new SMSService();
            DateTime today = DateTime.Today;
            MobileSMSSendOutHelper.RemoveMobileSMSSendOutInfo(today.AddDays(-1).ToString("yyyyMMdd"));
            IDictionary<string, int> dictionary = MobileSMSSendOutHelper.GetMobileDictionary(today.ToString("yyyyMMdd"));
            if (dictionary != null && dictionary.Count > 0)
            {
                if (dictionary.ContainsKey(mobile))
                {
                    int num = dictionary[mobile];
                    if (num > 10)
                    {
                        isOk = false;
                        msg = "对不起,同一个手机号码每天最多只能发送10次!";
                    }
                    else
                    {
                        smsService.SendSMS(sendMsg, mobile);

                        num++;
                        dictionary[mobile] = num;
                        isOk = true;
                    }
                }
                else
                {
                    smsService.SendSMS(sendMsg, mobile);
                    dictionary.Add(mobile, 1);
                    isOk = true;
                }
            }
            else
            {
                smsService.SendSMS(sendMsg, mobile);
                dictionary.Add(mobile, 1);
                isOk = true;
            }
            MobileSMSSendOutHelper.SetMobileSMSSendOutInfo(today.ToString("yyyyMMdd"), dictionary);

            return isOk;
        }
Beispiel #3
0
 static void Main(string[] args)
 {
     SMSService sms = new SMSService();
     sms.SendSMS("我来了", "18566267191");
 }