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 SetConfig()
        {
            string json = new StreamReader(Request.Body).ReadToEnd();
            var    tcm  = JsonConvert.DeserializeObject <TimerConfigModel>(json);

            TimerConfigModelContext.SaveConfigLog(tcm);
            return(this.JsonSuccessStatus());
        }
Пример #3
0
 public IActionResult GetConfig()
 {
     return(TimerConfigModelContext.GetConfig().ToJsonSuccess(this));
 }