Пример #1
0
        public void SendPool(object sender)
        {
            SendInfo info = sender as SendInfo;
            SmsBatchInfo batchInfo = new SmsBatchInfo();
            batchInfo.AccountID = info.AccountID;
            batchInfo.EnterPriseID = info.EnterpriseID;
            batchInfo.BatchName = info.BatchName;
            batchInfo.Remark = info.BatchRemark;
            batchInfo.SmsContent = info.Content;

            batchInfo.CommitTime = DateTime.Now;
            List<SmsTelesegInfo> telesegInfos = SmsTelesegManage.Instance.FindList(0, -1);
            List<SmsBlackphoneInfo> blackphoneInfos = SmsBlackPhoneManage.Instance.GetList(0, -1, info.EnterpriseID);
            List<SmsContentfilterkeyInfo> contentfilterkeyInfos = SmsContentfilterkeyManage.Instance.GetList(0, -1,
                                                                                                             info
                                                                                                                 .EnterpriseID);
            batchInfo.MsgType = 1;
            batchInfo.CreateTime = DateTime.Now.AddSeconds(-5);
            batchInfo.MessageState = 0;
            batchInfo.BatchState = 1;
            int batchId = SmsBatchManage.Instance.AddBatch(batchInfo);
            int mtpackLength = 100;
            int readCount = 0;
            int totalCount = 0;
            List<SmsBatchWaitInfo> waitInfos = new List<SmsBatchWaitInfo>();
            SmsBatchWaitInfo[] waitinfoarray = new SmsBatchWaitInfo[3];
            waitinfoarray[0] = new SmsBatchWaitInfo();
            waitinfoarray[1] = new SmsBatchWaitInfo();
            waitinfoarray[2] = new SmsBatchWaitInfo();
            List<string> allPhones = new List<string>();
            if (info.IsFileSend)
            {
                DataTable dt = new DataTable();
                /* 文件发送*/
                String dirPath = Path.Combine(Path.Combine(Request.PhysicalApplicationPath, "uplpod"), info.FileName);

                if (File.Exists(dirPath))
                {

                    dt = FileUtily.ReadDataTable(dirPath, 0, info.spilter, info.IsHeader);
                }
                totalCount = dt.Rows.Count;
                bool isGroup = info.Content.IndexOf("@") > -1;

                if (isGroup)
                {
                    SMSGroupInfo[] groupInfo = new SMSGroupInfo[3];
                    groupInfo[0] = new SMSGroupInfo();
                    groupInfo[0].groupInfos = new List<GroupInfo>();
                    groupInfo[1] = new SMSGroupInfo();
                    groupInfo[1].groupInfos = new List<GroupInfo>();
                    groupInfo[2] = new SMSGroupInfo();
                    groupInfo[2].groupInfos = new List<GroupInfo>();

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (!AppContent.isPhone(dt.Rows[i][0].ToString()))
                            continue;

                        if (info.FBlack && blackphoneInfos.Count > 0)
                        {
                            if (filterBlack(dt.Rows[i][0].ToString(), blackphoneInfos))
                                continue;
                        }
                        string content = ComparContent(info.Content, dt.Columns, dt.Rows[i]);
                        if (info.FKeyword && contentfilterkeyInfos.Count > 0)
                        {
                            if (filterContent(content, contentfilterkeyInfos))
                                continue;
                        }
                        if (info.FRepeat && allPhones.Contains(dt.Rows[i][0].ToString()))
                            continue;
                        allPhones.Add(dt.Rows[i][0].ToString());
                        int phonetel = getPhone(dt.Rows[i][0].ToString(), telesegInfos);
                        groupInfo[phonetel].groupInfos.Add(new GroupInfo()
                        {
                            Content = content,
                            Phone = dt.Rows[i][0].ToString()
                        });

                        readCount++;
                    }
                    for (int i = 0; i < 3; i++)
                    {
                        if (groupInfo[i].groupInfos.Count > 0)
                        {
                            waitinfoarray[i].AccountID = info.AccountID;
                            waitinfoarray[i].EnterPriseID = info.EnterpriseID;
                            waitinfoarray[i].CreateTime = DateTime.Now;
                            waitinfoarray[i].MsgCount = mtpackLength;
                            waitinfoarray[i].MsgType = 0;
                            waitinfoarray[i].MsgCarrier = i;
                            waitinfoarray[i].BatchID = batchId;
                            waitinfoarray[i].MsgPack = JsonHelper.SerializeObject(groupInfo[i]);
                            waitInfos.Add(waitinfoarray[i]);
                            groupInfo[i] = new SMSGroupInfo();
                            groupInfo[i].groupInfos = new List<GroupInfo>();
                            waitinfoarray[i] = new SmsBatchWaitInfo();
                        }
                    }
                }
                else
                {
                    bool isFContent = false;
                    if (info.FKeyword && contentfilterkeyInfos.Count > 0)
                    {
                        if (filterContent(info.Content, contentfilterkeyInfos))
                            isFContent = true;
                    }
                    if (!isFContent)
                    {
                        SMSMassInfo[] massInfo = new SMSMassInfo[3];
                        massInfo[0] = new SMSMassInfo();
                        massInfo[0].Content = info.Content;
                        massInfo[0].Phones = new List<string>();
                        massInfo[1] = new SMSMassInfo();
                        massInfo[1].Content = info.Content;
                        massInfo[1].Phones = new List<string>();
                        massInfo[2] = new SMSMassInfo();
                        massInfo[2].Content = info.Content;
                        massInfo[2].Phones = new List<string>();
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (!AppContent.isPhone(dt.Rows[i][0].ToString()))
                                continue;
                            if (info.FBlack && blackphoneInfos.Count > 0)
                            {
                                if (filterBlack(dt.Rows[i][0].ToString(), blackphoneInfos))
                                    continue;
                            }
                            if (info.FRepeat && allPhones.Contains(dt.Rows[i][0].ToString()))
                                continue;
                            allPhones.Add(dt.Rows[i][0].ToString());
                            int phonetel = getPhone(dt.Rows[i][0].ToString(), telesegInfos);
                            massInfo[phonetel].Phones.Add(
                                dt.Rows[i][0].ToString()
                                );

                            readCount++;
                        }
                        for (int i = 0; i < 3; i++)
                        {
                            if (massInfo[i].Phones.Count > 0)
                            {
                                waitinfoarray[i].AccountID = info.AccountID;
                                waitinfoarray[i].EnterPriseID = info.EnterpriseID;
                                waitinfoarray[i].CreateTime = DateTime.Now;
                                waitinfoarray[i].MsgCount = mtpackLength;
                                waitinfoarray[i].MsgType = 1;
                                waitinfoarray[i].BatchID = batchId;
                                waitinfoarray[i].MsgCarrier = i;
                                waitinfoarray[i].MsgPack = JsonHelper.SerializeObject(massInfo[i]);
                                waitInfos.Add(waitinfoarray[i]);
                                massInfo[i] = new SMSMassInfo();
                                massInfo[i].Content = info.Content;
                                massInfo[i].Phones = new List<string>();
                                waitinfoarray[i] = new SmsBatchWaitInfo();
                            }
                        }
                    }
                }

            }
            else
            {
                List<string> cids = new List<string>();
                List<SmsContactInfo> smsContactInfos = new List<SmsContactInfo>();
                /*联系人发送*/
                for (int i = 0; i < info.Mobiles.Length; i++)
                {
                    string mobile = info.Mobiles[i];
                    string submobile = mobile.Substring(0, 1);
                    switch (submobile)
                    {
                        case "c":
                            /*直接联系人*/
                            string cid = mobile.TrimStart('c').TrimStart('0');
                            cids.Add(cid);
                            break;
                        case "g":
                            string[] contions = mobile.TrimStart('g').Split('|');
                            int gid = 0;
                            if (int.TryParse(contions[0], out gid))
                                smsContactInfos.AddRange(SmsContactManage.Instance.getList(0, -1, int.Parse(contions[0]), contions[1], contions[2], info.EnterpriseID));
                            break;
                        case "1":
                            if (AppContent.isPhone(mobile))
                                smsContactInfos.Add(new SmsContactInfo()
                                    {
                                        Mobile = mobile,
                                        Birthday = DateTime.Parse("1910-1-1")
                                    });
                            break;
                    }
                }
                List<SmsContactInfo> contacts = SmsContactManage.Instance.GetContacts(cids, info.EnterpriseID);
                smsContactInfos.AddRange(contacts);

                bool isGroup = info.Content.IndexOf("@") > -1;
                totalCount = smsContactInfos.Count;
                if (isGroup)
                {

                    SMSGroupInfo[] groupInfo = new SMSGroupInfo[3];
                    groupInfo[0] = new SMSGroupInfo();
                    groupInfo[0].groupInfos = new List<GroupInfo>();
                    groupInfo[1] = new SMSGroupInfo();
                    groupInfo[1].groupInfos = new List<GroupInfo>();
                    groupInfo[2] = new SMSGroupInfo();
                    groupInfo[2].groupInfos = new List<GroupInfo>();
                    for (int i = 0; i < smsContactInfos.Count; i++)
                    {
                        SmsContactInfo contactInfo = smsContactInfos[i];
                        if (!AppContent.isPhone(contactInfo.Mobile))
                            continue;

                        if (info.FBlack && blackphoneInfos.Count > 0)
                        {
                            if (filterBlack(contactInfo.Mobile, blackphoneInfos))
                                continue;
                        }
                        string content = ComparContent(info.Content, contactInfo);
                        if (info.FKeyword && contentfilterkeyInfos.Count > 0)
                        {
                            if (filterContent(content, contentfilterkeyInfos))
                                continue;
                        }
                        if (info.FRepeat && allPhones.Contains(contactInfo.Mobile))
                            continue;
                        allPhones.Add(contactInfo.Mobile);
                        int phonetel = getPhone(contactInfo.Mobile, telesegInfos);
                        groupInfo[phonetel].groupInfos.Add(new GroupInfo()
                        {
                            Content = ComparContent(info.Content, contactInfo),
                            Phone = contactInfo.Mobile
                        });

                        readCount++;
                    }
                    for (int i = 0; i < 3; i++)
                    {
                        if (groupInfo[i].groupInfos.Count > 0)
                        {
                            waitinfoarray[i].AccountID = info.AccountID;
                            waitinfoarray[i].EnterPriseID = info.EnterpriseID;
                            waitinfoarray[i].CreateTime = DateTime.Now;
                            waitinfoarray[i].MsgCount = mtpackLength;
                            waitinfoarray[i].MsgType = 0;
                            waitinfoarray[i].MsgCarrier = i;
                            waitinfoarray[i].BatchID = batchId;
                            waitinfoarray[i].MsgPack = JsonHelper.SerializeObject(groupInfo[i]);
                            waitInfos.Add(waitinfoarray[i]);
                            groupInfo[i] = new SMSGroupInfo();
                            groupInfo[i].groupInfos = new List<GroupInfo>();
                            waitinfoarray[i] = new SmsBatchWaitInfo();
                        }
                    }
                }
                else
                {
                    bool isFContent = false;
                    if (info.FKeyword && contentfilterkeyInfos.Count > 0)
                    {
                        if (filterContent(info.Content, contentfilterkeyInfos))
                            isFContent = true;
                    }
                    if (!isFContent)
                    {
                        SMSMassInfo[] massInfo = new SMSMassInfo[3];
                        massInfo[0] = new SMSMassInfo();
                        massInfo[0].Content = info.Content;
                        massInfo[0].Phones = new List<string>();
                        massInfo[1] = new SMSMassInfo();
                        massInfo[1].Content = info.Content;
                        massInfo[1].Phones = new List<string>();
                        massInfo[2] = new SMSMassInfo();
                        massInfo[2].Content = info.Content;
                        massInfo[2].Phones = new List<string>();
                        for (int i = 0; i < smsContactInfos.Count; i++)
                        {
                            SmsContactInfo contactInfo = smsContactInfos[i];
                            if (!AppContent.isPhone(contactInfo.Mobile))
                                continue;
                            if (info.FBlack && blackphoneInfos.Count > 0)
                            {
                                if (filterBlack(contactInfo.Mobile, blackphoneInfos))
                                    continue;
                            }
                            if (info.FRepeat && allPhones.Contains(contactInfo.Mobile))
                                continue;
                            allPhones.Add(contactInfo.Mobile);
                            int phonetel = getPhone(contactInfo.Mobile, telesegInfos);
                            massInfo[phonetel].Phones.Add(
                                contactInfo.Mobile
                                );

                            readCount++;
                        }
                        for (int i = 0; i < 3; i++)
                        {
                            if (massInfo[i].Phones.Count > 0)
                            {
                                waitinfoarray[i].AccountID = info.AccountID;
                                waitinfoarray[i].EnterPriseID = info.EnterpriseID;
                                waitinfoarray[i].CreateTime = DateTime.Now;
                                waitinfoarray[i].MsgCount = mtpackLength;
                                waitinfoarray[i].MsgType = 1;
                                waitinfoarray[i].BatchID = batchId;
                                waitinfoarray[i].MsgCarrier = i;
                                waitinfoarray[i].MsgPack = JsonHelper.SerializeObject(massInfo[i]);
                                waitInfos.Add(waitinfoarray[i]);
                                massInfo[i] = new SMSMassInfo();
                                massInfo[i].Content = info.Content;
                                massInfo[i].Phones = new List<string>();
                                waitinfoarray[i] = new SmsBatchWaitInfo();
                            }
                        }
                    }
                }
            }
            SmsBatchAmountInfo amountInfo = new SmsBatchAmountInfo();
            amountInfo.BatchID = batchId;
            amountInfo.SendAmount = readCount;
            amountInfo.PlanSendCount = totalCount;
            amountInfo.RealAmount = readCount;
            amountInfo.SuccessAmount = 0;
            amountInfo.CreateTime = DateTime.Now;
            SmsBatchManage.Instance.AddBatchAmount(amountInfo);
            SmsBatchManage.Instance.AddBatchWait(waitInfos);
            if (readCount > 0)
                SmsBatchManage.Instance.UpdateState(batchId, BatchState.Waiting, waitInfos.Count);
            else
                SmsBatchManage.Instance.UpdateState(batchId, BatchState.Complete, waitInfos.Count);
        }
Пример #2
0
        public void SendPool(object sender)
        {
            SendInfo     info      = sender as SendInfo;
            SmsBatchInfo batchInfo = new SmsBatchInfo();

            batchInfo.AccountID    = info.AccountID;
            batchInfo.EnterPriseID = info.EnterpriseID;
            batchInfo.BatchName    = info.BatchName;
            batchInfo.Remark       = info.BatchRemark;
            batchInfo.SmsContent   = info.Content;

            batchInfo.CommitTime = DateTime.Now;
            List <SmsTelesegInfo>          telesegInfos          = SmsTelesegManage.Instance.FindList(0, -1);
            List <SmsBlackphoneInfo>       blackphoneInfos       = SmsBlackPhoneManage.Instance.GetList(0, -1, info.EnterpriseID);
            List <SmsContentfilterkeyInfo> contentfilterkeyInfos = SmsContentfilterkeyManage.Instance.GetList(0, -1,
                                                                                                              info
                                                                                                              .EnterpriseID);

            batchInfo.MsgType      = 1;
            batchInfo.CreateTime   = DateTime.Now.AddSeconds(-5);
            batchInfo.MessageState = 0;
            batchInfo.BatchState   = 1;
            int batchId      = SmsBatchManage.Instance.AddBatch(batchInfo);
            int mtpackLength = 100;
            int readCount    = 0;
            int totalCount   = 0;
            List <SmsBatchWaitInfo> waitInfos = new List <SmsBatchWaitInfo>();

            SmsBatchWaitInfo[] waitinfoarray = new SmsBatchWaitInfo[3];
            waitinfoarray[0] = new SmsBatchWaitInfo();
            waitinfoarray[1] = new SmsBatchWaitInfo();
            waitinfoarray[2] = new SmsBatchWaitInfo();
            List <string> allPhones = new List <string>();

            if (info.IsFileSend)
            {
                DataTable dt = new DataTable();
                /* 文件发送*/
                String dirPath = Path.Combine(Path.Combine(Request.PhysicalApplicationPath, "uplpod"), info.FileName);

                if (File.Exists(dirPath))
                {
                    dt = FileUtily.ReadDataTable(dirPath, 0, info.spilter, info.IsHeader);
                }
                totalCount = dt.Rows.Count;
                bool isGroup = info.Content.IndexOf("@") > -1;

                if (isGroup)
                {
                    SMSGroupInfo[] groupInfo = new SMSGroupInfo[3];
                    groupInfo[0]            = new SMSGroupInfo();
                    groupInfo[0].groupInfos = new List <GroupInfo>();
                    groupInfo[1]            = new SMSGroupInfo();
                    groupInfo[1].groupInfos = new List <GroupInfo>();
                    groupInfo[2]            = new SMSGroupInfo();
                    groupInfo[2].groupInfos = new List <GroupInfo>();

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (!AppContent.isPhone(dt.Rows[i][0].ToString()))
                        {
                            continue;
                        }

                        if (info.FBlack && blackphoneInfos.Count > 0)
                        {
                            if (filterBlack(dt.Rows[i][0].ToString(), blackphoneInfos))
                            {
                                continue;
                            }
                        }
                        string content = ComparContent(info.Content, dt.Columns, dt.Rows[i]);
                        if (info.FKeyword && contentfilterkeyInfos.Count > 0)
                        {
                            if (filterContent(content, contentfilterkeyInfos))
                            {
                                continue;
                            }
                        }
                        if (info.FRepeat && allPhones.Contains(dt.Rows[i][0].ToString()))
                        {
                            continue;
                        }
                        allPhones.Add(dt.Rows[i][0].ToString());
                        int phonetel = getPhone(dt.Rows[i][0].ToString(), telesegInfos);
                        groupInfo[phonetel].groupInfos.Add(new GroupInfo()
                        {
                            Content = content,
                            Phone   = dt.Rows[i][0].ToString()
                        });


                        readCount++;
                    }
                    for (int i = 0; i < 3; i++)
                    {
                        if (groupInfo[i].groupInfos.Count > 0)
                        {
                            waitinfoarray[i].AccountID    = info.AccountID;
                            waitinfoarray[i].EnterPriseID = info.EnterpriseID;
                            waitinfoarray[i].CreateTime   = DateTime.Now;
                            waitinfoarray[i].MsgCount     = mtpackLength;
                            waitinfoarray[i].MsgType      = 0;
                            waitinfoarray[i].MsgCarrier   = i;
                            waitinfoarray[i].BatchID      = batchId;
                            waitinfoarray[i].MsgPack      = JsonHelper.SerializeObject(groupInfo[i]);
                            waitInfos.Add(waitinfoarray[i]);
                            groupInfo[i]            = new SMSGroupInfo();
                            groupInfo[i].groupInfos = new List <GroupInfo>();
                            waitinfoarray[i]        = new SmsBatchWaitInfo();
                        }
                    }
                }
                else
                {
                    bool isFContent = false;
                    if (info.FKeyword && contentfilterkeyInfos.Count > 0)
                    {
                        if (filterContent(info.Content, contentfilterkeyInfos))
                        {
                            isFContent = true;
                        }
                    }
                    if (!isFContent)
                    {
                        SMSMassInfo[] massInfo = new SMSMassInfo[3];
                        massInfo[0]         = new SMSMassInfo();
                        massInfo[0].Content = info.Content;
                        massInfo[0].Phones  = new List <string>();
                        massInfo[1]         = new SMSMassInfo();
                        massInfo[1].Content = info.Content;
                        massInfo[1].Phones  = new List <string>();
                        massInfo[2]         = new SMSMassInfo();
                        massInfo[2].Content = info.Content;
                        massInfo[2].Phones  = new List <string>();
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            if (!AppContent.isPhone(dt.Rows[i][0].ToString()))
                            {
                                continue;
                            }
                            if (info.FBlack && blackphoneInfos.Count > 0)
                            {
                                if (filterBlack(dt.Rows[i][0].ToString(), blackphoneInfos))
                                {
                                    continue;
                                }
                            }
                            if (info.FRepeat && allPhones.Contains(dt.Rows[i][0].ToString()))
                            {
                                continue;
                            }
                            allPhones.Add(dt.Rows[i][0].ToString());
                            int phonetel = getPhone(dt.Rows[i][0].ToString(), telesegInfos);
                            massInfo[phonetel].Phones.Add(
                                dt.Rows[i][0].ToString()
                                );

                            readCount++;
                        }
                        for (int i = 0; i < 3; i++)
                        {
                            if (massInfo[i].Phones.Count > 0)
                            {
                                waitinfoarray[i].AccountID    = info.AccountID;
                                waitinfoarray[i].EnterPriseID = info.EnterpriseID;
                                waitinfoarray[i].CreateTime   = DateTime.Now;
                                waitinfoarray[i].MsgCount     = mtpackLength;
                                waitinfoarray[i].MsgType      = 1;
                                waitinfoarray[i].BatchID      = batchId;
                                waitinfoarray[i].MsgCarrier   = i;
                                waitinfoarray[i].MsgPack      = JsonHelper.SerializeObject(massInfo[i]);
                                waitInfos.Add(waitinfoarray[i]);
                                massInfo[i]         = new SMSMassInfo();
                                massInfo[i].Content = info.Content;
                                massInfo[i].Phones  = new List <string>();
                                waitinfoarray[i]    = new SmsBatchWaitInfo();
                            }
                        }
                    }
                }
            }
            else
            {
                List <string>         cids            = new List <string>();
                List <SmsContactInfo> smsContactInfos = new List <SmsContactInfo>();
                /*联系人发送*/
                for (int i = 0; i < info.Mobiles.Length; i++)
                {
                    string mobile    = info.Mobiles[i];
                    string submobile = mobile.Substring(0, 1);
                    switch (submobile)
                    {
                    case "c":
                        /*直接联系人*/
                        string cid = mobile.TrimStart('c').TrimStart('0');
                        cids.Add(cid);
                        break;

                    case "g":
                        string[] contions = mobile.TrimStart('g').Split('|');
                        int      gid      = 0;
                        if (int.TryParse(contions[0], out gid))
                        {
                            smsContactInfos.AddRange(SmsContactManage.Instance.getList(0, -1, int.Parse(contions[0]), contions[1], contions[2], info.EnterpriseID));
                        }
                        break;

                    case "1":
                        if (AppContent.isPhone(mobile))
                        {
                            smsContactInfos.Add(new SmsContactInfo()
                            {
                                Mobile   = mobile,
                                Birthday = DateTime.Parse("1910-1-1")
                            });
                        }
                        break;
                    }
                }
                List <SmsContactInfo> contacts = SmsContactManage.Instance.GetContacts(cids, info.EnterpriseID);
                smsContactInfos.AddRange(contacts);

                bool isGroup = info.Content.IndexOf("@") > -1;
                totalCount = smsContactInfos.Count;
                if (isGroup)
                {
                    SMSGroupInfo[] groupInfo = new SMSGroupInfo[3];
                    groupInfo[0]            = new SMSGroupInfo();
                    groupInfo[0].groupInfos = new List <GroupInfo>();
                    groupInfo[1]            = new SMSGroupInfo();
                    groupInfo[1].groupInfos = new List <GroupInfo>();
                    groupInfo[2]            = new SMSGroupInfo();
                    groupInfo[2].groupInfos = new List <GroupInfo>();
                    for (int i = 0; i < smsContactInfos.Count; i++)
                    {
                        SmsContactInfo contactInfo = smsContactInfos[i];
                        if (!AppContent.isPhone(contactInfo.Mobile))
                        {
                            continue;
                        }

                        if (info.FBlack && blackphoneInfos.Count > 0)
                        {
                            if (filterBlack(contactInfo.Mobile, blackphoneInfos))
                            {
                                continue;
                            }
                        }
                        string content = ComparContent(info.Content, contactInfo);
                        if (info.FKeyword && contentfilterkeyInfos.Count > 0)
                        {
                            if (filterContent(content, contentfilterkeyInfos))
                            {
                                continue;
                            }
                        }
                        if (info.FRepeat && allPhones.Contains(contactInfo.Mobile))
                        {
                            continue;
                        }
                        allPhones.Add(contactInfo.Mobile);
                        int phonetel = getPhone(contactInfo.Mobile, telesegInfos);
                        groupInfo[phonetel].groupInfos.Add(new GroupInfo()
                        {
                            Content = ComparContent(info.Content, contactInfo),
                            Phone   = contactInfo.Mobile
                        });


                        readCount++;
                    }
                    for (int i = 0; i < 3; i++)
                    {
                        if (groupInfo[i].groupInfos.Count > 0)
                        {
                            waitinfoarray[i].AccountID    = info.AccountID;
                            waitinfoarray[i].EnterPriseID = info.EnterpriseID;
                            waitinfoarray[i].CreateTime   = DateTime.Now;
                            waitinfoarray[i].MsgCount     = mtpackLength;
                            waitinfoarray[i].MsgType      = 0;
                            waitinfoarray[i].MsgCarrier   = i;
                            waitinfoarray[i].BatchID      = batchId;
                            waitinfoarray[i].MsgPack      = JsonHelper.SerializeObject(groupInfo[i]);
                            waitInfos.Add(waitinfoarray[i]);
                            groupInfo[i]            = new SMSGroupInfo();
                            groupInfo[i].groupInfos = new List <GroupInfo>();
                            waitinfoarray[i]        = new SmsBatchWaitInfo();
                        }
                    }
                }
                else
                {
                    bool isFContent = false;
                    if (info.FKeyword && contentfilterkeyInfos.Count > 0)
                    {
                        if (filterContent(info.Content, contentfilterkeyInfos))
                        {
                            isFContent = true;
                        }
                    }
                    if (!isFContent)
                    {
                        SMSMassInfo[] massInfo = new SMSMassInfo[3];
                        massInfo[0]         = new SMSMassInfo();
                        massInfo[0].Content = info.Content;
                        massInfo[0].Phones  = new List <string>();
                        massInfo[1]         = new SMSMassInfo();
                        massInfo[1].Content = info.Content;
                        massInfo[1].Phones  = new List <string>();
                        massInfo[2]         = new SMSMassInfo();
                        massInfo[2].Content = info.Content;
                        massInfo[2].Phones  = new List <string>();
                        for (int i = 0; i < smsContactInfos.Count; i++)
                        {
                            SmsContactInfo contactInfo = smsContactInfos[i];
                            if (!AppContent.isPhone(contactInfo.Mobile))
                            {
                                continue;
                            }
                            if (info.FBlack && blackphoneInfos.Count > 0)
                            {
                                if (filterBlack(contactInfo.Mobile, blackphoneInfos))
                                {
                                    continue;
                                }
                            }
                            if (info.FRepeat && allPhones.Contains(contactInfo.Mobile))
                            {
                                continue;
                            }
                            allPhones.Add(contactInfo.Mobile);
                            int phonetel = getPhone(contactInfo.Mobile, telesegInfos);
                            massInfo[phonetel].Phones.Add(
                                contactInfo.Mobile
                                );


                            readCount++;
                        }
                        for (int i = 0; i < 3; i++)
                        {
                            if (massInfo[i].Phones.Count > 0)
                            {
                                waitinfoarray[i].AccountID    = info.AccountID;
                                waitinfoarray[i].EnterPriseID = info.EnterpriseID;
                                waitinfoarray[i].CreateTime   = DateTime.Now;
                                waitinfoarray[i].MsgCount     = mtpackLength;
                                waitinfoarray[i].MsgType      = 1;
                                waitinfoarray[i].BatchID      = batchId;
                                waitinfoarray[i].MsgCarrier   = i;
                                waitinfoarray[i].MsgPack      = JsonHelper.SerializeObject(massInfo[i]);
                                waitInfos.Add(waitinfoarray[i]);
                                massInfo[i]         = new SMSMassInfo();
                                massInfo[i].Content = info.Content;
                                massInfo[i].Phones  = new List <string>();
                                waitinfoarray[i]    = new SmsBatchWaitInfo();
                            }
                        }
                    }
                }
            }
            SmsBatchAmountInfo amountInfo = new SmsBatchAmountInfo();

            amountInfo.BatchID       = batchId;
            amountInfo.SendAmount    = readCount;
            amountInfo.PlanSendCount = totalCount;
            amountInfo.RealAmount    = readCount;
            amountInfo.SuccessAmount = 0;
            amountInfo.CreateTime    = DateTime.Now;
            SmsBatchManage.Instance.AddBatchAmount(amountInfo);
            SmsBatchManage.Instance.AddBatchWait(waitInfos);
            if (readCount > 0)
            {
                SmsBatchManage.Instance.UpdateState(batchId, BatchState.Waiting, waitInfos.Count);
            }
            else
            {
                SmsBatchManage.Instance.UpdateState(batchId, BatchState.Complete, waitInfos.Count);
            }
        }