示例#1
0
 def get_by_wiki(citiao):
     q_res = g_Wiki.select().where(g_Wiki.title == citiao)
     tt = q_res.count()
     if tt == 0 or tt > 1:
         return None
     else:
         MWiki.update_view_count(citiao)
         return q_res.get()
示例#2
0
 def query_all(**kwargs):
     if 'kind' in kwargs:
         kind = kwargs['kind']
     else:
         kind = '1'
     if 'limit' in kwargs:
         limit = kwargs['limit']
     else:
         limit = 999999
     return g_Wiki.select().where(g_Wiki.kind == kind).limit(limit)
示例#3
0
 def query_recent_edited(timstamp, kind='1'):
     return g_Wiki.select().where((g_Wiki.kind == kind) & (
         g_Wiki.time_update > timstamp)).order_by(g_Wiki.time_update.desc())
示例#4
0
 def query_recent(num=8, kind='1'):
     return g_Wiki.select().where(g_Wiki.kind == kind).order_by(
         g_Wiki.time_update).limit(num)
示例#5
0
 def query_random(num=6, kind='1'):
     return g_Wiki.select().where(g_Wiki.kind == kind).order_by(
         peewee.fn.Random()).limit(num)
示例#6
0
 def get_counts():
     '''
     The count in table.
     :return:
     '''
     return g_Wiki.select().count()
示例#7
0
 def query_most(num=8, kind='1'):
     return g_Wiki.select().where(g_Wiki.kind == kind).order_by(
         g_Wiki.view_count.desc()).limit(num)
示例#8
0
 def query_dated(num=10, kind='1'):
     return g_Wiki.select().where(g_Wiki.kind == kind).order_by(
         g_Wiki.time_update.desc()).limit(num)