ltv 多维度
This commit is contained in:
parent
a729174c51
commit
b0b7d6de6c
@ -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,
|
||||
|
@ -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
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user