Пример #1
0
 public void Execute(IJobExecutionContext context)
 {
     Logger.Info("DailySitemapJob启动");
     try
     {
         Stopwatch stopWatch = new Stopwatch();
         stopWatch.Start();
         bool result = URLBusiness.InsertDailyURLToDB(isFull);
         stopWatch.Stop();
         TimeSpan ts = stopWatch.Elapsed;
         if (result)
         {
             Logger.Info($"DailySitemapJob执行成功");
         }
         else
         {
             Logger.Info($"DailySitemapJob执行失败");
         }
         Logger.Info(string.Format("耗时:{0}s", ts.TotalSeconds));
     }
     catch (Exception ex)
     {
         Logger.Error($"DailySitemapJob异常:{ex.ToString()}");
     }
 }
Пример #2
0
        public void Execute(IJobExecutionContext context)
        {
            Logger.Info("WeeklySitemapJob启动");
            try
            {
                if (!Boolean.Parse(ConfigurationManager.AppSettings["SitemapJobIsClose"]))
                {
                    Stopwatch stopWatch = new Stopwatch();
                    stopWatch.Start();

                    bool result = URLBusiness.GenerateTireUrlFiles();

                    /*
                     * bool result=URLBusiness.CreateFiles();
                     * bool result1 = URLBusiness.InsertWeeklyURLToDB(isFull);
                     * bool result2= URLBusiness.GenerateSitemapFile(isFull);
                     */
                    stopWatch.Stop();
                    TimeSpan ts = stopWatch.Elapsed;
                    if (result)
                    {
                        Logger.Info($"WeeklySitemapJob执行成功");
                    }
                    else
                    {
                        Logger.Info($"WeeklySitemapJob执行失败");
                    }
                    Logger.Info(string.Format("耗时:{0}s", ts.TotalSeconds));
                }
                else
                {
                    Logger.Info($"WeeklySitemapJob已关闭");
                }
            }
            catch (Exception ex)
            {
                Logger.Error($"WeeklySitemapJob异常:{ex.ToString()}");
            }
        }