diff --git a/api/api_v1/endpoints/data_auth.py b/api/api_v1/endpoints/data_auth.py index bb5632a..b7509e4 100644 --- a/api/api_v1/endpoints/data_auth.py +++ b/api/api_v1/endpoints/data_auth.py @@ -106,7 +106,10 @@ async def my_event(request: Request, ) -> schemas.Msg: """获取自己的事件权限""" 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: diff --git a/db/ckdb.py b/db/ckdb.py index adcb5c3..30556f9 100644 --- a/db/ckdb.py +++ b/db/ckdb.py @@ -53,8 +53,8 @@ class CKDrive: res = await self.execute(sql) return res[0]['count'] - async def distinct(self, db: str, tb: str, field: str): - sql = f'select distinct `{field}` as v from {db}.{tb}' + async def distinct(self, db: str, tb: str, field: str, where: str = '1'): + sql = f'select distinct `{field}` as v from {db}.{tb} where {where}' res = await self.query_dataframe(sql) return res['v'].to_list()