public static PushFunction PushFunc(PushMode pushMode, MsgType msgType)
        {
            PushFunction pf = null;

            switch (pushMode)
            {
            case PushMode.WeChat:
                pf = PushWeChatFactory.PushMsg(pushMode, msgType);
                break;

            case PushMode.ShortMsg:
                //pf = PushShortMsg
                pf = PushShortMsgFactory.PushMsg(pushMode, msgType);
                break;
            }
            return(pf);
        }
        /// <summary>
        /// 推送(短信、微信)
        /// </summary>
        public static void PushContentFunction()
        {
            try
            {
                while (true)
                {
                    PushServer    ps = new PushServer();
                    U_AccessToken accessTokenModel = new U_AccessToken();
                    accessTokenModel.UserKey      = ConfigSugar.GetAppString("WeChatCorpID");
                    accessTokenModel.UserPassword = ConfigSugar.GetAppString("WeChatSecret");
                    string responseMsg = "";
                    bool   result      = false;
                    #region 推送图文
                    List <Business_WeChatPush_Information> listImgPush = ps.GetImgPushList();//获取要推送的数据
                    List <U_Content> contentList = new List <U_Content>();
                    foreach (var imgPush in listImgPush)
                    {
                        //主表信息
                        U_Content content = new U_Content();
                        content.Message        = imgPush.Message;
                        content.MessageType    = imgPush.MessageType;
                        content.Title          = imgPush.Title;
                        content.CoverDescption = imgPush.CoverDescption;
                        content.CoverImg       = imgPush.CoverImg;
                        content.PushType       = imgPush.PushType;
                        content.VGUID          = imgPush.VGUID;
                        content.RevenueType    = 0;
                        content.PushObject     = ps.GetPushUserWeChat(imgPush);//获取推送信息接收者信息列表
                        contentList.Add(content);
                        //子表信息
                        var moreGraphicList          = ps.GetMoreGraphicList(imgPush.VGUID);
                        PushFunction.PushFunction pf = PushFunctionFactory.PushFunc(PushMode.WeChat, MsgType.SingleTextAndImg);
                        foreach (var item in moreGraphicList)
                        {
                            U_Content contentGraphic = new U_Content();
                            contentGraphic.Message        = item.Message;
                            contentGraphic.Title          = item.Title;
                            contentGraphic.CoverDescption = item.CoverDescption;
                            contentGraphic.CoverImg       = item.CoverImg;
                            contentGraphic.VGUID          = item.VGUID;
                            contentGraphic.RevenueType    = item.Ranks;
                            contentList.Add(contentGraphic);
                        }
                        var pushPersonList = contentList[0].PushObject;
                        //如果发送对象超过1000个则需要分批发送
                        if (pushPersonList.Count > 1000)
                        {
                            int pushCount = (pushPersonList.Count / 1000) + 1;//分批发送(发送次数)
                            for (int i = 0; i < pushCount; i++)
                            {
                                contentList[0].PushObject = pushPersonList.Skip(i * 1000).Take(1000).ToList();
                                //定时发送
                                if (contentList[0].TimedSendTime != null)
                                {
                                    if (DateTime.Now >= contentList[0].TimedSendTime)
                                    {
                                        pf.Push(accessTokenModel, contentList);
                                    }
                                }
                                else
                                {
                                    pf.Push(accessTokenModel, contentList);
                                }
                            }
                        }
                        else
                        {
                            //定时发送
                            if (contentList[0].TimedSendTime != null)
                            {
                                if (DateTime.Now >= contentList[0].TimedSendTime)
                                {
                                    pf.Push(accessTokenModel, contentList);
                                }
                            }
                            else
                            {
                                pf.Push(accessTokenModel, contentList);
                            }
                        }
                    }

                    #endregion
                    List <Business_WeChatPush_Information> pushList = ps.GetPushList();//获取要推送的数据
                    //循环推送数据列表(获取要推送人员列表)
                    foreach (var item in pushList)
                    {
                        try
                        {
                            PushFunction.PushFunction pf = PushFunctionFactory.PushFunc((PushMode)item.PushType, (MsgType)item.MessageType);
                            if (item.PushType == 1)//微信
                            {
                                U_Content content = new U_Content();
                                //content.PushObject = "@all";
                                //content.Message = "D:\\567925.png";
                                content.Message            = item.Message;
                                content.ExercisesVGUID     = item.ExercisesVGUID;
                                content.MessageType        = item.MessageType;
                                content.Title              = item.Title;
                                content.CoverDescption     = item.CoverDescption;
                                content.CoverImg           = item.CoverImg;
                                content.PushType           = item.PushType;
                                content.VGUID              = item.VGUID;
                                content.RevenueType        = item.RevenueType;
                                content.RedpacketMoney     = item.RedpacketMoney;
                                content.RedpacketType      = item.RedpacketType;
                                content.RedpacketMoneyFrom = item.RedpacketMoneyFrom;
                                content.RedpacketMoneyTo   = item.RedpacketMoneyTo;
                                List <Business_Personnel_Information> pushPersonList = ps.GetPushUserWeChat(item);//获取推送信息接收者信息列表
                                content.PushObject = pushPersonList;
                                //如果发送对象超过1000个则需要分批发送
                                if (pushPersonList.Count > 1000)
                                {
                                    int pushCount = (pushPersonList.Count / 1000) + 1;//分批发送(发送次数)
                                    for (int i = 0; i < pushCount; i++)
                                    {
                                        content.PushObject = pushPersonList.Skip(i * 1000).Take(1000).ToList();
                                        //定时发送
                                        if (item.TimedSendTime != null)
                                        {
                                            if (DateTime.Now >= item.TimedSendTime)
                                            {
                                                pf.Push(accessTokenModel, content);
                                            }
                                        }
                                        else
                                        {
                                            pf.Push(accessTokenModel, content);
                                        }
                                    }
                                }
                                else
                                {
                                    //定时发送
                                    if (item.TimedSendTime != null)
                                    {
                                        if (DateTime.Now >= item.TimedSendTime)
                                        {
                                            pf.Push(accessTokenModel, content);
                                        }
                                    }
                                    else
                                    {
                                        pf.Push(accessTokenModel, content);
                                    }
                                }
                            }
                            else//短信
                            {
                                List <Business_Personnel_Information> pushPersonList = ps.GetPushUserSms(item);//获取推送信息接收者信息列表
                                List <U_Content> uCountList = new List <U_Content>();
                                foreach (var person in pushPersonList)
                                {
                                    U_Content content = new U_Content();
                                    content.Message        = item.Message;
                                    content.MessageType    = item.MessageType;
                                    content.Title          = item.Title;
                                    content.CoverDescption = item.CoverDescption;
                                    content.CoverImg       = item.CoverImg;
                                    content.PushType       = item.PushType;
                                    content.VGUID          = item.VGUID;
                                    content.PushObject     = new List <Business_Personnel_Information>();
                                    content.PushObject.Add(person);
                                    uCountList.Add(content);
                                }
                                //定时发送
                                if (item.TimedSendTime != null)
                                {
                                    if (DateTime.Now >= item.TimedSendTime)
                                    {
                                        pf.Push(accessTokenModel, uCountList);
                                    }
                                }
                                else
                                {
                                    pf.Push(accessTokenModel, uCountList);
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            LogManager.WriteLog(LogFile.Error, ex.ToString());
                        }
                    }
                    Thread.Sleep(5 * 1000);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                LogManager.WriteLog(LogFile.Error, ex.ToString());
            }
        }