Пример #1
0
 def get_previous_record(self, in_uid):
     current_rec = self.get_by_id(in_uid)
     query = CabWiki.select().where(CabWiki.time_update > current_rec.time_update).order_by(CabWiki.time_update)
     if query.count() == 0:
         return None
     else:
         return query.get()
Пример #2
0
 def get_by_wiki(self, citiao):
     tt = CabWiki.select().where(CabWiki.title == citiao).count()
     if tt == 0:
         return None
     else:
         self.update_view_count(citiao)
         return CabWiki.get(CabWiki.title == citiao)
Пример #3
0
 def get_by_wiki(self, citiao):
     tt = CabWiki.select().where(CabWiki.title == citiao).count()
     if tt == 0:
         return None
     else:
         self.update_view_count(citiao)
         return CabWiki.get(CabWiki.title == citiao)
Пример #4
0
 def query_cat_by_pager(self, cat_str, cureent):
     tt = (
         CabWiki.select()
         .where(CabWiki.id_cats.contains(str(cat_str)))
         .order_by(CabWiki.time_update.desc())
         .paginate(cureent, config.page_num)
     )
     return tt
Пример #5
0
 def get_next_record(self, in_uid):
     current_rec = self.get_by_id(in_uid)
     query = (
         CabWiki.select().where(CabWiki.time_update < current_rec.time_update).order_by(CabWiki.time_update.desc())
     )
     if query.count() == 0:
         return None
     else:
         return query.get()
Пример #6
0
 def get_previous_record(self, in_uid):
     current_rec = self.get_by_id(in_uid)
     query = CabWiki.select().where(
         CabWiki.time_update > current_rec.time_update).order_by(
             CabWiki.time_update)
     if query.count() == 0:
         return None
     else:
         return query.get()
Пример #7
0
 def get_by_id(self, in_uid):
     tt = CabWiki.select().where(CabWiki.uid == in_uid).count()
     if tt == 0:
         return None
     else:
         return CabWiki.get(CabWiki.uid == in_uid)
Пример #8
0
 def get_num_by_cat(self, cat_str):
     return CabWiki.select().where(
         CabWiki.id_cats.contains(',{0},'.format(cat_str))).count()
Пример #9
0
 def query_old(self):
     return CabWiki.select().order_by('time_update').limit(10)
Пример #10
0
 def query_random(self, num=6):
     if config.dbtype == 1 or config.dbtype == 3:
         return CabWiki.select().order_by(peewee.fn.Random()).limit(num)
     elif config.dbtype == 2:
         return CabWiki.select().order_by(peewee.fn.Rand()).limit(num)
Пример #11
0
 def query_recent(self, num=8):
     return CabWiki.select().order_by(CabWiki.time_update.desc()).limit(num)
Пример #12
0
 def get_by_keyword(self, par2):
     return CabWiki.select().where(CabWiki.title.contains(par2)).order_by(
         CabWiki.time_update.desc()).limit(20)
Пример #13
0
 def get_by_id(self, in_uid):
     tt = CabWiki.select().where(CabWiki.uid == in_uid).count()
     if tt == 0:
         return None
     else:
         return CabWiki.get(CabWiki.uid == in_uid)
Пример #14
0
 def query_random(self, num=6):
     if config.dbtype == 1 or config.dbtype == 3:
         return CabWiki.select().order_by(peewee.fn.Random()).limit(num)
     elif config.dbtype == 2:
         return CabWiki.select().order_by(peewee.fn.Rand()).limit(num)
Пример #15
0
 def query_recent_most(self, num=8, recent=30):
     time_that = int(time.time()) - 30 * 24 * 3600
     return CabWiki.select().where(
         CabWiki.time_update > time_that).order_by(
             CabWiki.view_count.desc()).limit(num)
Пример #16
0
 def query_cat_by_pager(self, cat_str, cureent):
     tt = CabWiki.select().where(CabWiki.id_cats.contains(
         str(cat_str))).order_by(CabWiki.time_update.desc()).paginate(
             cureent, config.page_num)
     return tt
Пример #17
0
 def query_most(self, num=8):
     return CabWiki.select().order_by(CabWiki.view_count.desc()).limit(num)
Пример #18
0
 def query_dated(self, num=8):
     return CabWiki.select().order_by(CabWiki.time_update).limit(num)
Пример #19
0
 def query_recent(self, num=8):
     return CabWiki.select().order_by(CabWiki.time_update.desc()).limit(num)
Пример #20
0
 def query_dated(self, num = 10):
     return CabWiki.select().order_by(CabWiki.time_update.desc()).limit(num)
Пример #21
0
 def get_num_by_cat(self, cat_str):
     return CabWiki.select().where(CabWiki.id_cats.contains(',{0},'.format(cat_str))).count()
Пример #22
0
 def get_by_keyword(self, par2):
     return CabWiki.select().where(CabWiki.title.contains(par2)).order_by(CabWiki.time_update.desc()).limit(20)
Пример #23
0
 def query_old(self):
     return CabWiki.select().order_by('time_update').limit(10)
Пример #24
0
 def query_most(self, num=8):
     return CabWiki.select().order_by(CabWiki.view_count.desc()).limit(num)
Пример #25
0
 def query_by_spec(self, spec_id):
     tt = CabWiki.select().where(CabWiki.id_spec == spec_id).order_by(
         CabWiki.time_update.desc())
     return tt
Пример #26
0
 def query_by_spec(self, spec_id):
     tt = CabWiki.select().where(CabWiki.id_spec == spec_id).order_by(CabWiki.time_update.desc())
     return tt
Пример #27
0
 def query_recent_most(self, num=8, recent=30):
     time_that = int(time.time()) - 30 * 24 * 3600
     return CabWiki.select().where(CabWiki.time_update > time_that).order_by(CabWiki.view_count.desc()).limit(num)