Exemplo n.º 1
0
        public static void WriteTotalOnlineNumToDB(DBManager dbMgr)
        {
            DateTime dateTime = DateTime.Now;
            long     nowTicks = dateTime.Ticks / 10000L;

            if (nowTicks - OnlineUserNumMgr.LastWriteDBTicks >= 120000L)
            {
                OnlineUserNumMgr.LastWriteDBTicks = nowTicks;
                int    totalNum         = LineManager.GetTotalOnlineNum();
                string strMapOnlineInfo = LineManager.GetMapOnlineNum();
                DBWriter.AddNewOnlineNumItem(dbMgr, totalNum, dateTime, strMapOnlineInfo);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 将当前的在线人数写入数据库中
        /// </summary>
        /// <param name="dbMgr"></param>
        public static void WriteTotalOnlineNumToDB(DBManager dbMgr)
        {
            DateTime dateTime = DateTime.Now;
            long     nowTicks = dateTime.Ticks / 10000;

            if (nowTicks - LastWriteDBTicks < (2L * 60L * 1000L))
            {
                return;
            }

            LastWriteDBTicks = nowTicks;

            //获取所有线路总的在线人数
            int    totalNum         = LineManager.GetTotalOnlineNum();
            String strMapOnlineInfo = LineManager.GetMapOnlineNum();

            //添加一个新的在线人数记录
            DBWriter.AddNewOnlineNumItem(dbMgr, totalNum, dateTime, strMapOnlineInfo);

            //GameDBManager.DBEventsWriter.CacheOnlineuer(-1,
            //    GameDBManager.ZoneID,
            //    totalNum,
            //    dateTime.ToString("yyyy-MM-dd HH:mm:ss"));
        }