Exemplo n.º 1
0
        public static void UpdateOnlineTime(int oltimespan, int uid)
        {
            if (oltimespan != 0)
            {
                if (LastOnlineTime == 0)
                {
                    LastOnlineTime = Environment.TickCount;
                }

                int num = Environment.TickCount - LastOnlineTime;
                if (num <= 0 || num >= oltimespan * 60 * 1000)
                {
                    //BBX.Data.OnlineUsers.UpdateOnlineTime(oltimespan, uid);
                    OnlineTime.UpdateOnlineTime(oltimespan, uid);
                    //WebHelper.WriteCookie("lastactivity", "onlinetime", Environment.TickCount.ToString());
                    LastOnlineTime = Environment.TickCount;
                    num            = Environment.TickCount - LastOLTime;
                    if (LastOLTime == 0 || num <= 0 || num >= 2 * oltimespan * 60 * 1000)
                    {
                        //BBX.Data.OnlineUsers.SynchronizeOnlineTime(uid);
                        OnlineTime.SynchronizeOnlineTime(uid);
                        //WebHelper.WriteCookie("lastactivity", "oltime", Environment.TickCount.ToString());
                        LastOLTime = Environment.TickCount;
                    }
                }
            }
        }
Exemplo n.º 2
0
 static void Execute(Object state)
 {
     Statistic.UpdateYesterdayPosts();
     Statistic.Reset();
     if (DateTime.Today.Day == 1)
     {
         OnlineTime.ResetThismonthOnlineTime();
         StatVar.Update("onlines", "lastupdate", "0");
     }
 }
Exemplo n.º 3
0
        protected override int OnDelete()
        {
            Field.Delete();

            var ot = OnlineTime.FindByUid(ID);

            if (ot != null)
            {
                ot.Delete();
            }

            var pls = Poll.FindAllByUid(ID);

            pls.Delete();

            var favs = Favorite.FindAllByUid(ID);

            favs.Delete();

            var mods = Moderator.FindAllByUid(ID);

            mods.Delete();

            // 更新用户总数
            var st = Statistic.Current;

            st.TotalUsers--;

            // 更新最后用户
            var user = FindLast();

            if (user != null)
            {
                st.LastUserID   = user.ID;
                st.LastUserName = user.Name;
            }

            st.Save();

            return(base.OnDelete());
        }