void AddStatistic() { PageVisitor pv; if (Session[PageVisitorHelper.PageVisitorSessionKey] == null) { pv = PageVisitorHelper.AddPageVisitor(AccountID); Session[PageVisitorHelper.PageVisitorSessionKey] = pv; } else { pv = (PageVisitor)Session[PageVisitorHelper.PageVisitorSessionKey]; } if (pv != null) { StatisticsHelper.AddStatistics(pv, ArticleID, ColumnID); TimeSpan ts = DateTime.Now - pv.OnlineTime; pv.Clicks += 1; if (ts.TotalSeconds > 10)//改为10秒 刷新在线时间 { pv.OnlineTime = DateTime.Now; pv.LogoutDate = DateTime.Now; PageVisitorHelper.UpdatePageVisitor(pv, new string[] { "OnlineTime", "LogoutDate", "Clicks" }); } } else { Session[PageVisitorHelper.PageVisitorSessionKey] = null; } }
void AddUserLoginStatistics() { PageVisitorHelper.AddPageVisitor(AccountID); }