获取所有事件

This commit is contained in:
wuaho 2021-09-09 21:38:11 +08:00
parent f8b2b6ce77
commit af004e941c
2 changed files with 6 additions and 3 deletions

View File

@ -106,7 +106,10 @@ async def my_event(request: Request,
) -> schemas.Msg: ) -> schemas.Msg:
"""获取自己的事件权限""" """获取自己的事件权限"""
event_list = [] event_list = []
my_data_auth = await ck.distinct(game, 'event', '#event_name') # start_date = (datetime.datetime.now()-datetime.timedelta(days=30)).strftime('%Y-%m-%d %H:%M:%S')
# where = f"""`#event_time` > '{start_date}'"""
# my_data_auth = await ck.distinct(game, 'event', '#event_name',where)
my_data_auth = await rdb.smembers(f'{game}_event_set')
# #
# else: # else:

View File

@ -53,8 +53,8 @@ class CKDrive:
res = await self.execute(sql) res = await self.execute(sql)
return res[0]['count'] return res[0]['count']
async def distinct(self, db: str, tb: str, field: str): async def distinct(self, db: str, tb: str, field: str, where: str = '1'):
sql = f'select distinct `{field}` as v from {db}.{tb}' sql = f'select distinct `{field}` as v from {db}.{tb} where {where}'
res = await self.query_dataframe(sql) res = await self.query_dataframe(sql)
return res['v'].to_list() return res['v'].to_list()