/// <summary>
    /// 发送短信 即时验证码
    /// </summary>
    /// <param name="Message">信息内容</param>
    /// <param name="Phone">手机号码</param>
    /// <param name="ToUserName">商户微信号或ID</param>
    /// <returns>发送结果</returns>
    public string Send(string Message, string Phone)
    {
        string content = Message + "【小时光】";
        string url     = "http://www.ztsms.cn:8800/sendXSms.do?username=puman&password=puman2014&mobile=" + Phone + "&content=" + content + "&dstime=&productid=676767&xh=";
        string msg     = PostRequest(url);

        try
        {
            WXDXLog d = new WXDXLog();
            d.JG           = msg;
            d.Merchants_ID = 0;
            d.CONTENT      = content;
            d.Time         = DateTime.Now;
            d.ToUser       = Phone;
            d.MSTYPE       = "微信";
            mss.SaveDX(d);
            if (msg.Contains("1,"))
            {
                msg = "发送成功";
            }
            else
            {
                msg = "发送失败";
            }
        }
        catch (Exception)
        {
        }

        return(msg);
    }
Beispiel #2
0
    /// <summary>
    /// 发送短信
    /// </summary>
    /// <param name="Message">信息内容</param>
    /// <param name="Phone">手机号码</param>
    /// <param name="ToUserName">商户微信号或ID</param>
    /// <returns>发送结果</returns>
    public string Send(string Message, string Phone, ORG_INFO org)
    {
        //string pwd = "123456a";
        //string encodedPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(pwd, FormsAuthPasswordFormat.SHA1.ToString("G"));
        //string taskName = "短信即时发送_" + DateTime.Now.Ticks.ToString();
        //string mobileList = Phone;
        //string content = Message + "【美街微店】";
        //string msg = Mt("SDK-BBX-010-19253", getMD5("SDK-BBX-010-19253e-5ec2-["), mobileList, content, "", "", "");
        //try
        //{
        //    WXDXLog d = new WXDXLog();
        //    d.JG = msg;
        //    d.Merchants_ID = Merchants_ID;
        //    d.MSTYPE = "验证码";
        //    d.CONTENT = content;
        //    d.Time = DateTime.Now;
        //    d.ToUser = mobileList;
        //    dxl.Save(d);
        //    if (msg.Contains("发送成功"))
        //        msg = "发送成功";
        //    else
        //        msg = "发送失败";
        //}
        //catch (Exception)
        //{

        //}
        try
        {
            Hmj.WebApp.SendSMS.SMSServiceSoapClient s = new Hmj.WebApp.SendSMS.SMSServiceSoapClient();
            string jg = s.SendSMS(Phone, 8, Message, DateTime.Parse("2010-01-01"), "7101038130214180");
            //string content = Message + "【美街微店】";
            //string url = "http://www.ztsms.cn:8800/sendXSms.do?username=puman&password=puman2014&mobile=" + Phone + "&content=" + content + "&dstime=&productid=676767&xh=";
            //string msg = PostRequest(url);


            Hmj.Entity.WXDXLog d = new Hmj.Entity.WXDXLog();
            d.JG           = jg;
            d.Merchants_ID = org.ID;
            d.CONTENT      = Message;
            d.Time         = DateTime.Now;
            d.ToUser       = Phone;
            d.MSTYPE       = "微信";
            mss.SaveDX(d);
            if (jg.Contains("OK"))
            {
                jg = "发送成功";
            }
            else
            {
                jg = "发送失败";
            }
            return(jg);
        }
        catch (Exception ex)
        {
            Hmj.Entity.WXDXLog d = new Hmj.Entity.WXDXLog();
            d.JG           = "";
            d.Merchants_ID = org.ID;
            d.CONTENT      = ex.Message + "," + ex.StackTrace;
            d.Time         = DateTime.Now;
            d.ToUser       = Phone;
            d.MSTYPE       = "微信";
            mss.SaveDX(d);
            return("");
        }
    }