Beispiel #1
0
 def get_by_wiki(self, citiao):
     tt = g_User2Reply.select().where(g_User2Reply.title == citiao).count()
     if tt == 0:
         return None
     else:
         self.update_view_count(citiao)
         return g_User2Reply.get(g_User2Reply.title == citiao)
Beispiel #2
0
 def get_previous_record(self, in_uid):
     current_rec = self.get_by_id(in_uid)
     query = g_User2Reply.select().where(g_User2Reply.time_update > current_rec.time_update).order_by(
         g_User2Reply.time_update)
     if query.count() == 0:
         return None
     else:
         return query.get()
Beispiel #3
0
    def create_reply(user_id, reply_id):

        record = g_User2Reply.select().where(
            (g_User2Reply.reply_id == reply_id)
            & (g_User2Reply.user_id == user_id))

        if record.count() > 0:
            pass
        else:
            g_User2Reply.create(
                uid=tools.get_uuid(),
                reply_id=reply_id,
                user_id=user_id,
                timestamp=time.time(),
            )
Beispiel #4
0
    def insert_data(self, user_id, reply_id):

        record = g_User2Reply.select().where(
            (g_User2Reply.reply_id == reply_id) & (g_User2Reply.user_id == user_id))

        print('reply_voter_count', user_id, record.count())
        if record.count() > 0:
            # return g_Voter2Reply.select().where(g_Voter2Reply.reply_id == reply_id).count()
            # return (False)
            pass
        else:
            g_User2Reply.create(
            uid=tools.get_uuid(),
            reply_id=reply_id,
            user_id=user_id,
            timestamp=time.time(),
        )
Beispiel #5
0
 def get_by_zan(reply_id):
     return g_User2Reply.select().where(
         g_User2Reply.reply_id == reply_id).count()
Beispiel #6
0
 def query_most(self, num=8):
     return g_User2Reply.select().order_by(g_User2Reply.view_count.desc()).limit(num)
Beispiel #7
0
 def query_cat_recent(self, cat_id, num=8):
     return g_User2Reply.select().join(g_Post2Tag).where(g_Post2Tag.tag == cat_id).order_by(
         g_User2Reply.time_update.desc()).limit(num)
Beispiel #8
0
 def query_dated(self, num=8):
     return g_User2Reply.select().order_by(g_User2Reply.time_update).limit(num)
Beispiel #9
0
 def query_keywords_empty(self):
     return g_User2Reply.select().where(g_User2Reply.keywords == '')
Beispiel #10
0
 def get_num_by_cat(self, cat_str):
     return g_User2Reply.select().where(g_User2Reply.id_cats.contains(',{0},'.format(cat_str))).count()
Beispiel #11
0
 def get_voter_count(self, reply_id):
     return g_User2Reply.select().where(g_User2Reply.reply_id == reply_id).count()