public void StartRefresh()
        {
            timer = new Timer(obj =>
            {
                var cfg = TimerConfigModelContext.GetConfig();

                if (DateTime.Now.Hour == cfg.RefreshMerchantStartHour && DateTime.Now.Minute == cfg.RefreshMerchantStartMinutes)
                {
                    using (AllCountData allCountData = new AllCountData())
                    {
                        allCountData.RefreshMerchants();
                    }
                }

                if (DateTime.Now.Hour == cfg.RefreshWeChatCountStartHour && DateTime.Now.Minute == cfg.RefreshWeChatCountStartMinutes)
                {
                    using (var countData = new WeChatCountData())
                    {
                        countData.RefreshWeChatCountData();
                    }
                }

                if (DateTime.Now.Hour == cfg.RefreshAllCountStartHour && DateTime.Now.Minute == cfg.RefreshAllCountStartMinutes)
                {
                    using (var countData = new WeChatCountData())
                    {
                        countData.RefreshCountSumData();
                    }
                }
                //cfg = null;
                //GC.Collect();
            }, null, 0, period);
        }
예제 #2
0
 public IActionResult GetConfig()
 {
     return(TimerConfigModelContext.GetConfig().ToJsonSuccess(this));
 }