示例#1
0
            public override async Task RunAsync()
            {
                int liveRoomCount = await Collector.CollectRoomCountAsync("0").ConfigureAwait(true);

                ShowLogInfo(liveRoomCount.ToString());
                var item = BilibiliLiveRoomCount.Create(liveRoomCount);

                using var context = new BilibiliDbContext(DbConfig);
                context.Database.EnsureCreated();
                context.LiveRoomCount.Add(item);
                await context.SaveChangesAsync();
            }
示例#2
0
        public static BilibiliLiveRoomCount Create(int count)
        {
            DateTime now = DateTime.Now;
            var      b   = new BilibiliLiveRoomCount()
            {
                RoomCount = count,
                Month     = now.Month,
                Day       = now.Day,
                Hour      = now.Hour
            };

            return(b);
        }
示例#3
0
            public override async Task RunAsync()
            {
                Collector.BeforeCollectAsync();
                int liveRoomCount = await Collector.CollectAsync("0");

                ShowLogInfo(liveRoomCount.ToString());
                using (var context = new BilibiliLiveRoomCountMySqlContext())
                {
                    context.Database.EnsureCreated();
                    var item = BilibiliLiveRoomCount.Create(liveRoomCount);
                    context.LiveRoomCount.Add(item);
                    context.SaveChanges();
                }
            }