From 8d71ef15e11cc84a00addab0a5b0673a2bf55167 Mon Sep 17 00:00:00 2001 From: wuaho Date: Thu, 9 Sep 2021 17:56:58 +0800 Subject: [PATCH] 1 --- models/user_analysis.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/models/user_analysis.py b/models/user_analysis.py index cfbc4e5..e71a8c0 100644 --- a/models/user_analysis.py +++ b/models/user_analysis.py @@ -34,7 +34,7 @@ class UserAnalysis: self.date_range = None self.unit_num = None - async def init(self): + async def init(self, *args, **kwargs): if self.data_in.report_id: db = get_database() report = await crud.report.get(db, id=self.data_in.report_id) @@ -50,6 +50,9 @@ class UserAnalysis: self.time_particle = self._get_time_particle_size() self.groupby = self._get_group_by() self.unit_num = self._get_unit_num() + # 用户自带过滤 + if 'data_where' in kwargs: + self.global_filters.extend(kwargs['data_where'].get(self.game, [])) async def _init_table(self): """ @@ -136,7 +139,7 @@ class UserAnalysis: print(sql) result = {'sql': sql, 'groupby': [i.key for i in self.groupby], - 'quota':event['quota'] + 'quota': event['quota'] } return result