Exemple #1
0
 public void StreamStopped()
 {
     DataBase.me.recBLiveEnd(lid, new_commers, viewerlist.Count(), 0, selver_coins, gold_coins);
     MainHolder.broadcaster.BroadcastToAdminGroup("直播结束\n事件识别ID " + lid + "\n\n直播数据统计(系统在线期间) \n" +
                                                  "活跃观众  " + (ispickedup ? "-" : viewerlist.Count().ToString()) + "<+" + new_commers + ">\n" +
                                                  "金瓜子  " + gold_coins + "\n" +
                                                  "银瓜子  " + selver_coins);
     gold_coins   = 0;
     selver_coins = 0;
     new_commers  = 0;
     viewerlist.Clear();
     lid = -1;
     MainHolder.checkCrewGroup();
     ListTenMoreGradeUsers();
 }
Exemple #2
0
        public static void run()
        {
            int counter = 0;
            int lasterr = 0;

            while (true)
            {
                try
                {
                    counter++;
                    if (counter % 600 == 0)
                    {//5分钟一次
                        GC.Collect(5, GCCollectionMode.Optimized, true, true);
                        if (!MainHolder.bililogin.IsOnline())
                        {
                            MainHolder.broadcaster.BroadcastToAdminGroup("BiliWebToken似乎已经失效,将触发重新登录。\n");
                            MainHolder.doBiliLogin = true;
                        }
                    }
                    if (counter % 3600 == 0)
                    {//一小时执行一次
                        MainHolder.broadcaster.BroadcastToAdminGroup("[在线]\n" +
                                                                     "最近一条消息:" + lastrecv.ToString() + "\n" +
                                                                     "时段总接收消息:" + MainHolder.MsgCount + "\n" +
                                                                     "上次检查:" + laststat.ToString());
                        laststat            = DateTime.Now;
                        MainHolder.MsgCount = 0;
                    }
                    if (counter % 30 == 0)
                    {//每半分钟一次
                        if (MainHolder.bilidmkproc?.lid <= 0)
                        {
                            MainHolder.bilidmkproc?.PickupRunningLive();
                        }
                    }
                    if (counter % (60 * 60 * 12) == 0)
                    {//12小时一次
                        MainHolder.checkCrewGroup();
                    }
                    if ((counter + (60 * 60 * 6)) % (60 * 60 * 12) == 0)
                    {//12小时一次,错位+6小时      帮小伙伴续费黑名单>_<
                     //trigger_BanRefresh();
                    }
                    if (counter >= (60 * 60 * 24))
                    {
                        counter = 0;//以一天为循环体
                    }
                    WatchDog.FeedDog("sckt");
                    MainHolder.bilidmkproc?.UpdateLiveDataToDB();//每秒都更新数据库
                }
                catch (Exception err)
                {
                    if ((counter - lasterr) < (60 * 60))
                    {
                        continue;
                    }

                    MainHolder.broadcaster.BroadcastToAdminGroup("[计划任务失败]\n计划任务未能顺利完成(每小时仅报错一次防止持续错误刷屏)\n" + err.Message + "\nStack:" + err.StackTrace);
                }
                Thread.Sleep(1000);
            }
        }