Exemple #1
0
        public static void Send(IMsgSendArgs args, MsgSendType type, string strPhone)
        {
            if (!IsUsingMsg)
            {
                return;
            }

            if (string.IsNullOrEmpty(strPhone))
            {
                return;
            }

            if (!IsUsing(args, type))
            {
                return;
            }
            string _msg = GetMsg(args, type) + msgextraInfo;
            //短信内容
            string strContent = HttpUtility.UrlEncode(_msg, Encoding.UTF8);

            //要发送的内容
            string strSend = "reg=" + strReg + "&pwd=" + strPwd + "&sourceadd=" + strSourceAdd +
                             "&phone=" + strPhone + "&content=" + strContent;

            //发送
            HttpSend.postSend(url, strSend);
        }
Exemple #2
0
        public static int BalanceQuery()
        {
            //要发送的内容
            string strSend = "reg=" + strReg + "&pwd=" + strPwd;
            //发送
            string strResult = HttpSend.postSend(balanceUrl, strSend);

            if (!string.IsNullOrEmpty(strResult))
            {
                try
                {
                    string c = strResult.Split('&')[1].Split('=')[1];
                    if (!string.IsNullOrEmpty(c))
                    {
                        return(Convert.ToInt32(c));
                    }
                }
                catch { }
            }
            return(0);
        }
Exemple #3
0
        public static bool DirectSend(string Msginfo, string strPhone, SendUserInfo userinfo, int channelID = 0)
        {
            bool blsendok = false;

            if (string.IsNullOrEmpty(strPhone))
            {
                return(false);
            }
            if (string.IsNullOrEmpty(Msginfo))
            {
                return(false);
            }
            string _msg = Msginfo + msgextraInfo;

            int _percount = 40;
            int i         = _msg.Length / _percount;
            int j         = _msg.Length % _percount;

            if (j > 0)
            {
                i = i + 1;
            }
            string[] _ps = strPhone.Split(',');
            int      _p  = _ps.Length;

            int psCount = _p * i;
            //短信内容
            string strContent = HttpUtility.UrlEncode(_msg, Encoding.UTF8);

            //要发送的内容
            string strSend = "";
            string newurl  = url;

            if (channelID == 0)
            {
                strSend = "reg=" + strReg + "&pwd=" + strPwd + "&sourceadd=" + strSourceAdd +
                          "&phone=" + strPhone + "&content=" + strContent;
            }
            else
            {
                strSend = "reg=" + strReg1 + "&pwd=" + strPwd1 + "&sourceadd=" + strSourceAdd1 +
                          "&phone=" + strPhone + "&content=" + strContent;
                newurl = url1;
            }
            string   r             = string.Empty;
            DateTime beginSendTime = DateTime.Now;
            int      success       = 0;

            try
            {
                //发送
                r = HttpSend.postSend(newurl, strSend);
            }
            catch { }
            if (!string.IsNullOrEmpty(r) && r.Split('&')[0].Split('=')[1].Equals("0"))
            {
                blsendok = true;
                success  = psCount;
            }

            DateTime endSendTime = DateTime.Now;

            //记录日志
            if ((userinfo != null) && (userinfo.isLog == 1))
            {
                try
                {
                    #region 维护短信发送记录

                    DataProvider.GetEAP_Provider().ExecuteNonQuery("insert into EAP_MsgRecord(orgid,senddate,enddate,telcount,successcount,failcount,domain,notetxt,Phones,senduser) values(@orgid,@senddate,@enddate,@telcount,@successcount,@failcount,@domain,@notetxt,@phones,@Senduser)",
                                                                   new SqlParameter("@orgid", userinfo.orgid), new SqlParameter("@senddate", beginSendTime),
                                                                   new SqlParameter("@enddate", endSendTime), new SqlParameter("@telcount", psCount),
                                                                   new SqlParameter("@successcount", success), new SqlParameter("@failcount", psCount - success),
                                                                   new SqlParameter("@domain", channelID.ToString()), new SqlParameter("@notetxt", _msg),
                                                                   new SqlParameter("@phones", strPhone), new SqlParameter("@Senduser", userinfo.username)
                                                                   );

                    #endregion
                }
                catch { }
            }
            //

            return(blsendok);
        }