Ejemplo n.º 1
0
 def get_by_wiki(self, citiao):
     tt = g_Voter2Reply.select().where(
         g_Voter2Reply.title == citiao).count()
     if tt == 0:
         return None
     else:
         self.update_view_count(citiao)
         return g_Voter2Reply.get(g_Voter2Reply.title == citiao)
Ejemplo n.º 2
0
 def get_previous_record(self, in_uid):
     current_rec = self.get_by_id(in_uid)
     query = g_Voter2Reply.select().where(
         g_Voter2Reply.time_update > current_rec.time_update).order_by(
             g_Voter2Reply.time_update)
     if query.count() == 0:
         return None
     else:
         return query.get()
Ejemplo n.º 3
0
    def insert_data(self, user_id, reply_id):

        record = g_Voter2Reply.select().where(
            (g_Voter2Reply.reply_id == reply_id)
            & (g_Voter2Reply.voter_id == user_id))

        if record.count() > 0:
            return (False)

        try:
            g_Voter2Reply.create(
                uid=tools.get_uuid(),
                reply_id=reply_id,
                voter_id=user_id,
                timestamp=time.time(),
            )
            return g_Voter2Reply.select().where(
                g_Voter2Reply.reply_id == reply_id).count()

        except:
            return False
Ejemplo n.º 4
0
 def query_cat_recent(self, cat_id, num=8):
     return g_Voter2Reply.select().join(g_Post2Tag).where(
         g_Post2Tag.tag == cat_id).order_by(
             g_Voter2Reply.time_update.desc()).limit(num)
Ejemplo n.º 5
0
 def query_dated(self, num=8):
     return g_Voter2Reply.select().order_by(
         g_Voter2Reply.time_update).limit(num)
Ejemplo n.º 6
0
 def query_keywords_empty(self):
     return g_Voter2Reply.select().where(g_Voter2Reply.keywords == '')
Ejemplo n.º 7
0
 def get_num_by_cat(self, cat_str):
     return g_Voter2Reply.select().where(
         g_Voter2Reply.id_cats.contains(',{0},'.format(cat_str))).count()
Ejemplo n.º 8
0
 def query_most(self, num=8):
     return g_Voter2Reply.select().order_by(
         g_Voter2Reply.view_count.desc()).limit(num)
Ejemplo n.º 9
0
 def get_by_zan(self, reply_id):
     return g_Voter2Reply.select().where(
         g_Voter2Reply.reply_id == reply_id).count()