本文整理汇总了Python中torlite.model.core_tab.CabVoter2Reply.select方法的典型用法代码示例。如果您正苦于以下问题:Python CabVoter2Reply.select方法的具体用法?Python CabVoter2Reply.select怎么用?Python CabVoter2Reply.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类torlite.model.core_tab.CabVoter2Reply
的用法示例。
在下文中一共展示了CabVoter2Reply.select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: query_random
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import select [as 别名]
def query_random(self, num=6):
if config.dbtype == 1 or config.dbtype == 3:
return CabVoter2Reply.select().order_by(
peewee.fn.Random()).limit(num)
elif config.dbtype == 2:
return CabVoter2Reply.select().order_by(
peewee.fn.Rand()).limit(num)
示例2: query_cat_random
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import select [as 别名]
def query_cat_random(self, cat_id, num=6):
if cat_id == '':
return self.query_random(num)
if config.dbtype == 1 or config.dbtype == 3:
return CabVoter2Reply.select().join(CabPost2Catalog).where(CabPost2Catalog.catalog == cat_id).order_by(
peewee.fn.Random()).limit(num)
elif config.dbtype == 2:
return CabVoter2Reply.select().join(CabPost2Catalog).where(CabPost2Catalog.catalog == cat_id).order_by(
peewee.fn.Rand()).limit(num)
示例3: get_by_wiki
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import select [as 别名]
def get_by_wiki(self, citiao):
tt = CabVoter2Reply.select().where(CabVoter2Reply.title == citiao).count()
if tt == 0:
return None
else:
self.update_view_count(citiao)
return CabVoter2Reply.get(CabVoter2Reply.title == citiao)
示例4: get_previous_record
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import select [as 别名]
def get_previous_record(self, in_uid):
current_rec = self.get_by_id(in_uid)
query = CabVoter2Reply.select().where(CabVoter2Reply.time_update > current_rec.time_update).order_by(
CabVoter2Reply.time_update)
if query.count() == 0:
return None
else:
return query.get()
示例5: insert_data
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import select [as 别名]
def insert_data(self, user_id, reply_id):
record = CabVoter2Reply.select().where(
(CabVoter2Reply.reply_id == reply_id) & ( CabVoter2Reply.voter_id == user_id ))
if record.count() > 0:
pass
return (False)
else:
entry = CabVoter2Reply.create(
uid=tools.get_uuid(),
reply_id=reply_id,
voter_id=user_id,
timestamp=time.time(),
)
cur_count = CabVoter2Reply.select().where(CabVoter2Reply.reply_id == reply_id).count()
return cur_count
示例6: insert_data
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import select [as 别名]
def insert_data(self, user_id, reply_id):
record = CabVoter2Reply.select().where(
(CabVoter2Reply.reply_id == reply_id) & (CabVoter2Reply.voter_id == user_id))
if record.count() > 0:
return (False)
try:
CabVoter2Reply.create(
uid=tools.get_uuid(),
reply_id=reply_id,
voter_id=user_id,
timestamp=time.time(),
)
return CabVoter2Reply.select().where(CabVoter2Reply.reply_id == reply_id).count()
except:
return False
示例7: query_most
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import select [as 别名]
def query_most(self, num=8):
return CabVoter2Reply.select().order_by(
CabVoter2Reply.view_count.desc()).limit(num)
示例8: query_cat_recent
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import select [as 别名]
def query_cat_recent(self, cat_id, num=8):
return CabVoter2Reply.select().join(CabPost2Catalog).where(
CabPost2Catalog.catalog == cat_id).order_by(
CabVoter2Reply.time_update.desc()).limit(num)
示例9: query_dated
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import select [as 别名]
def query_dated(self, num=8):
return CabVoter2Reply.select().order_by(
CabVoter2Reply.time_update).limit(num)
示例10: query_recent
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import select [as 别名]
def query_recent(self, num=8):
return CabVoter2Reply.select().order_by(
CabVoter2Reply.time_update.desc()).limit(num)
示例11: query_keywords_empty
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import select [as 别名]
def query_keywords_empty(self):
return CabVoter2Reply.select().where(CabVoter2Reply.keywords == '')
示例12: get_by_zan
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import select [as 别名]
def get_by_zan(self, reply_id):
return CabVoter2Reply.select().where(CabVoter2Reply.reply_id == reply_id).count()
示例13: query_by_spec
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import select [as 别名]
def query_by_spec(self, spec_id):
tt = CabVoter2Reply.select().where(
CabVoter2Reply.id_spec == spec_id).order_by(
CabVoter2Reply.time_update.desc())
return tt
示例14: get_by_id
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import select [as 别名]
def get_by_id(self, in_uid):
recs = CabVoter2Reply.select().where(
CabVoter2Reply.reply_id == in_uid).order_by(
CabVoter2Reply.timestamp.desc())
return recs
示例15: query_old
# 需要导入模块: from torlite.model.core_tab import CabVoter2Reply [as 别名]
# 或者: from torlite.model.core_tab.CabVoter2Reply import select [as 别名]
def query_old(self):
return CabVoter2Reply.select().order_by('time_update').limit(10)