public void Test()
        {
            Console.WriteLine("工作执行" + string.Format("推送! - {0}", DateTime.Now.ToString()));
            logger.Info("工作执行" + string.Format("推送! - {0}", DateTime.Now.ToString()));
            try
            {
                string webPath = ConfigurationManager.AppSettings.Get("domain");
                string tempStr = GetTemp(webPath + "/Temp.html");

                var accessToken = AccessTokenContainer.TryGetToken(
                    ConfigurationManager.AppSettings.Get("ShortWeixinAppId"),
                    ConfigurationManager.AppSettings.Get("ShortWeixinSecret"));
                PushNews(accessToken, webPath, tempStr);
                Console.WriteLine("提交" + string.Format("推送成功! - {0}", DateTime.Now.ToString()));
                logger.Info("提交" + string.Format("推送成功! - {0}", DateTime.Now.ToString()));
                //accessToken = AccessTokenContainer.TryGetToken(
                //ConfigurationManager.AppSettings.Get("LongNameAppId"),
                //ConfigurationManager.AppSettings.Get("LongNameAppSecret"));
                //PushNews(accessToken, webPath, tempStr);
                //var MailService = new MailSendFunc();
                //MailService.SendMail("*****@*****.**", "正常运行推送一次", "运行推送正常", mailCfg);
            }
            catch (Exception ex)
            {
                var MailService = new MailSendFunc();
                MailService.SendMail("*****@*****.**", ex.Message, " 定时运行推送异常", mailCfg);
                Console.WriteLine(DateTime.Now.ToString() + " 定时执行推送失败 异常信息为" + ex.Message);
                logger.ErrorException(DateTime.Now.ToString() + " 定时执行推送失败 " + ex.Message, ex);
            }
        }
        public virtual void Execute(IJobExecutionContext context)
        {
            JobKey jobKey = context.JobDetail.Key;

            Console.WriteLine("工作执行" + string.Format("推送! - {0}", DateTime.Now.ToString()));
            logger.Info("工作执行" + string.Format("推送! - {0}", DateTime.Now.ToString()));
            try
            {
                string webPath = ConfigurationManager.AppSettings.Get("domain");
                string tempStr = GetTemp(webPath + "/Temp.html");

                var accessToken = AccessTokenContainer.TryGetToken(
                    ConfigurationManager.AppSettings.Get("ShortWeixinAppId"),
                    ConfigurationManager.AppSettings.Get("ShortWeixinSecret"));
                PushNews(accessToken, webPath, tempStr);
                Console.WriteLine("提交" + string.Format("推送成功! - {0}", DateTime.Now.ToString()));
                logger.Info("提交" + string.Format("推送成功! - {0}", DateTime.Now.ToString()));
                //accessToken = AccessTokenContainer.TryGetToken(
                //ConfigurationManager.AppSettings.Get("LongNameAppId"),
                //ConfigurationManager.AppSettings.Get("LongNameAppSecret"));
                //PushNews(accessToken, webPath, tempStr);
                //var MailService = new MailSendFunc();
                //MailService.SendMail("*****@*****.**", "正常运行推送一次", "运行推送正常", mailCfg);
            }
            catch (Exception ex)
            {
                var MailService = new MailSendFunc();
                MailService.SendMail("*****@*****.**", ex.Message, " 定时运行推送异常", mailCfg);
                Console.WriteLine(DateTime.Now.ToString() + " 定时执行推送失败 异常信息为" + ex.Message);
                logger.ErrorException(DateTime.Now.ToString() + " 定时执行推送失败 " + ex.Message, ex);
            }
            string message = context.JobDetail.JobDataMap.GetString(Message);

            Console.WriteLine(string.Format("执行完成: {0} executing at {1}", jobKey, DateTime.Now.ToString()));
            logger.Info(string.Format("执行完成: {0} executing at {1}", jobKey, DateTime.Now.ToString()));
            logger.Info(string.Format("执行完成: msg: {0}", message));
        }
        public void PushNews(string accessToken, string webPath, string tempStr)
        {
            OpenIdResultJson json = UserApi.Get(accessToken, "");
            var imgResult         = MediaApi.GetOthersMediaList(accessToken, UploadMediaFileType.image, 0, 10000);
            var DircetPath        = Environment.CurrentDirectory + "/image/";

            if (!Directory.Exists(DircetPath))
            {
                Directory.CreateDirectory(DircetPath);
            }

            for (int i = 0; i < 6; i++)
            {
                string imgName = string.Format("send{0}.jpg", i);
                if (imgResult.item.Find(p => p.name == imgName) == null)
                {
                    var imgPath  = webPath + "/image/" + imgName;
                    var filePath = DircetPath + "/image/" + imgName;
                    CommonUtility.HttpUtility.DownloadFile(imgPath, filePath);
                    var mediaId = MediaApi.UploadForeverMedia(accessToken, filePath).media_id;
                }
            }
            imgResult = MediaApi.GetOthersMediaList(accessToken, UploadMediaFileType.image, 0, 10000);


            string sendCountTxtUrl = webPath + "/" + "sendcount.txt";
            var    sendCountTxt    = CommonUtility.HttpUtility.Get(sendCountTxtUrl);
            var    sendCount       = int.Parse(sendCountTxt);

            NewsModel[] newsList = new NewsModel[sendCount];

            var dataSevice = new DataAccessSerive();
            var jobList    = dataSevice.GetTopJobInfoList();

            if (jobList.Count > 0)
            {
                List <Article> articles = new List <Article>();
                int            i        = 0;
                string         imgName;
                foreach (var job in jobList)
                {
                    if (i == sendCount)
                    {
                        break;
                    }
                    string domain  = ConfigurationManager.AppSettings.Get("domain");
                    string website = ConfigurationManager.AppSettings.Get("website");
                    imgName = "send" + i.ToString() + ".jpg";
                    string imgUrl    = string.Format("{0}/image/{1}", domain, imgName);
                    var    jobDetail = dataSevice.GetJobDetail(job.JobId);
                    var    news      = new NewsModel()
                    {
                        author  = "",
                        content = tempStr.Replace("[ComName]", job.ComName)
                                  .Replace("[ComBrief]", jobDetail.ComBrief)
                                  .Replace("[DetailPalce]", jobDetail.DetailPalce)
                                  .Replace("[LinkMan]", jobDetail.LinkMan)
                                  .Replace("[Phone]", jobDetail.Phone)
                                  .Replace("[JobName]", jobDetail.JobName)
                                  .Replace("[JobType]", jobDetail.JobType)
                                  .Replace("[LowMoney]", jobDetail.LowMoney)
                                  .Replace("[HrNum]", jobDetail.HrNum)
                                  .Replace("[Edu]", jobDetail.Edu)
                                  .Replace("[RegisterDate]", jobDetail.RegisterDate)
                                  .Replace("[EffectDate]", jobDetail.EffectDate)
                                  .Replace("[Other]", jobDetail.Other)
                                  .Replace("[Sex]", jobDetail.Sex)
                        ,
                        //content_source_url = domain + "/html/detail.html?id=" + job.JobId,
                        content_source_url = website,
                        digest             = job.ComName + "诚聘" + job.JobName,
                        show_cover_pic     = "0",
                        thumb_media_id     = imgResult.item.Find(p => p.name == imgName).media_id,
                        title = job.ComName + "诚聘" + job.JobName
                    };
                    newsList[i] = news;
                    i++;
                }
                UploadForeverMediaResult mediaResult = MediaApi.UploadNews(accessToken, 100000, newsList);
                try
                {
                    if (isDebug != "1")
                    {
                        GroupMessageApi.SendGroupMessageByGroupId(accessToken, "-1", mediaResult.media_id, GroupMessageType.mpnews, true);
                    }
                    Console.WriteLine("素材提交推送  推送成功");
                    logger.Info(DateTime.Now.ToString() + " 素材提交推送  推送成功");
                }
                catch (Exception ex)
                {
                    Console.WriteLine("素材提交推送  推送失败 " + ex.Message);
                    var MailService = new MailSendFunc();
                    MailService.SendMail("*****@*****.**", ex.Message, "素材提交推送异常", mailCfg);
                    logger.ErrorException(DateTime.Now.ToString() + "素材提交推送失败 " + ex.Message, ex);
                }
            }
        }