diff --git a/api/api_v1/endpoints/data_auth.py b/api/api_v1/endpoints/data_auth.py index b6ffc24..34d31dd 100644 --- a/api/api_v1/endpoints/data_auth.py +++ b/api/api_v1/endpoints/data_auth.py @@ -95,6 +95,9 @@ async def data_authority(request: Request, return schemas.Msg(code=0, msg='ok', data=data) + + + @router.get("/my_event") async def my_event(request: Request, game: str, diff --git a/models/x_analysis.py b/models/x_analysis.py index 5b057c3..c82fd9d 100644 --- a/models/x_analysis.py +++ b/models/x_analysis.py @@ -81,7 +81,7 @@ class XAnalysis: def ltv_model_sql(self): days = (arrow.get(self.event_view['endTime']).date() - arrow.get(self.event_view['startTime']).date()).days - + quota = self.event_view['quota'] select_ltv = [] sumpay = [] for i in range(1, days): @@ -106,7 +106,7 @@ class XAnalysis: sql = f"""SELECT toString(reg.date) as date, cnt1, {select_ltv_str} - FROM (SELECT toDate(addHours(`#event_time`, `#zone_offset`)) as date, uniqExact(`#account_id`) cnt1 + FROM (SELECT toDate(addHours(`#event_time`, `#zone_offset`)) as date, uniqExact(`{quota}`) cnt1 FROM {self.game}.event where `#event_name` = 'create_account' AND {where_str} @@ -114,14 +114,14 @@ class XAnalysis: left join (select a.date, {sumpay_str} - from (SELECT toDate(addHours(`#event_time`, `#zone_offset`)) as date, `#account_id` + from (SELECT toDate(addHours(`#event_time`, `#zone_offset`)) as date, `{quota}` FROM {self.game}.event where `#event_name` = 'create_account' and {where_str}) as a - left join (select `#account_id`, unitPrice/100 as money, toDate(addHours(`#event_time`, `#zone_offset`)) as date + left join (select `{quota}`, unitPrice/100 as money, toDate(addHours(`#event_time`, `#zone_offset`)) as date from {self.game}.event where `#event_name` = 'pay') b - on a.`#account_id` = b.`#account_id` + on a.`{quota}` = b.`{quota}` group by a.date) log on reg.date = log.date order by date """