/// <summary> /// 清除所有的浏览历史 /// </summary> public bool ClearHistory(long?userId) { var swhDal = new sys_windows_history_dal(); var allList = swhDal.GetHisList(userId); if (allList != null && allList.Count > 0) { allList.ForEach(_ => { swhDal.Delete(_); }); } return(true); }
/// <summary> /// 浏览历史管理 /// </summary> public void BrowseHistory(sys_windows_history history, long userId) { var swhDal = new sys_windows_history_dal(); var oldHis = swhDal.GetByUrl(history.url, userId); var timeNow = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now); var tt = Tools.Date.DateHelper.ToUniversalTimeStamp(); if (oldHis != null) { oldHis.create_time = timeNow; oldHis.create_user_id = userId; swhDal.Update(oldHis); } else { history.id = swhDal.GetNextIdCom(); history.create_time = timeNow; history.create_user_id = userId; swhDal.Insert(history); // todo 删除50之后的数据 swhDal.DeletFifty(); } }