def query_all(current_page_num=1): ''' 查询所有未登录用户的访问记录 ''' return TabLog.select().where(TabLog.user_id == 'None').order_by(TabLog.time_out.desc()).paginate( current_page_num, CMS_CFG['list_num'] )
def query_pager_by_user(userid, current_page_num=1): ''' Query pager ''' return TabLog.select().where(TabLog.user_id == userid).order_by( TabLog.time_create.desc()).paginate(current_page_num, CMS_CFG['list_num'])
def query_all_pageview(current_page_num=1): ''' 查询所有页面(current_url),分页 ''' return TabLog.select().distinct(TabLog.current_url).order_by(TabLog.current_url).paginate( current_page_num, CMS_CFG['list_num'] )
def query_all_user(): ''' 查询所有登录用户的访问记录 ''' return TabLog.select().where(TabLog.user_id != 'None').distinct(TabLog.user_id).order_by( TabLog.user_id )
def get_retention_time_by_id(uid, user_id): current_rec = MLog.get_by_uid(uid) recs = TabLog.select().where((TabLog.user_id == user_id) & ( TabLog.time_create > current_rec.time_create)).order_by( TabLog.time_create) if recs.count(): return recs.get() return None
def count_of_certain(user_id): recs = TabLog.select().where(TabLog.user_id == user_id) return recs.count()
def total_number(): ''' Return the number of certian slug. ''' return TabLog.select().count()
def query_all_user(current_page_num=1): ''' Query pager ''' return TabLog.select().distinct(TabLog.user_id).order_by( TabLog.user_id).paginate(current_page_num, CMS_CFG['list_num'])
def total_number(): ''' Return the number of Tablog. ''' return TabLog.select().count()
def count_of_current_url(current_url): ''' 长询制订页面(current_url)的访问量 ''' res = TabLog.select().where(TabLog.current_url == current_url) return res.count()
def query_all_current_url(): ''' 查询所有页面(current_url) ''' return TabLog.select().distinct(TabLog.current_url).order_by(TabLog.current_url)
def get_pageview_count(current_url): recs = TabLog.select().where(TabLog.current_url == current_url) return recs.count()
def count_of_certain_pageview(): recs = TabLog.select().distinct(TabLog.current_url).order_by(TabLog.current_url) return recs.count()
def total_number(): ''' Return the number of Tablog. ''' # adding ``None`` to hide ``No value for argument 'database' in method call`` return TabLog.select().count(None)
def get_all(num=200): ''' 查询近期访问记录 ''' return TabLog.select().order_by(TabLog.time_create.desc()).limit(num)