コード例 #1
0
        private void DoJob()
        {
            var count = DalTask.GetAuthenticationUserCount();

            if (count == 0)
            {
                Logger.Warn("查询车型认证任务初始化用户数量为0");
                return;
            }
            var step  = 10000;
            var start = 0;

            Logger.Info($"查询车型认证任务初始化数据为{count}条,每批{step}条,共{count / step + 1}批");
            var watcher = new Stopwatch();

            while (start < count)
            {
                watcher.Start();
                var data = DalTask.GetAuthenticationUserList(start, step);
                if (data.Any())
                {
                    foreach (var item in data)
                    {
                        TuhuNotification.SendNotification("notification.TaskActionQueue", new Dictionary <string, string>
                        {
                            ["UserId"]     = item.ToString("D"),
                            ["ActionName"] = "7Authentication"
                        });
                        Thread.Sleep(100);
                    }
                }
                watcher.Stop();
                Logger.Info($"车型认证任务初始化,第{start / step + 1}批数据,用时{watcher.ElapsedMilliseconds}毫秒");
                watcher.Reset();
                start += step;
            }
            watcher.Stop();
        }