From f074d0eb472a078d44420af9f6d71a580be52c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80=C3=AE=C3=97=C3=9A=C3=95=C3=B1?= Date: Fri, 19 Aug 2022 11:49:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E5=B8=83=E5=88=86=E6=9E=90h5=E6=80=BB?= =?UTF-8?q?=E6=95=B0=E5=85=BC=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api_v1/endpoints/query.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/api_v1/endpoints/query.py b/api/api_v1/endpoints/query.py index 65fafc4..a3aa5c6 100644 --- a/api/api_v1/endpoints/query.py +++ b/api/api_v1/endpoints/query.py @@ -1557,7 +1557,14 @@ async def scatter_model( if where == "step_id" and event_type == "guide": sql = f"""SELECT toDate(addHours({game}.event."#event_time", 8)) AS date, count(DISTINCT {game}.event."#account_id") AS values FROM {game}.event WHERE addHours({game}.event."#event_time", 8) >= '{start_date}' AND addHours({game}.event."#event_time", 8) <= '{end_date}' AND {game}.event."#event_name" = 'create_account' GROUP BY toDate(addHours({game}.event."#event_time", 8)) ORDER BY date""" df = await ckdb.query_dataframe(sql) + # for kk, ste_df in df.groupby('date'): + # if str(kk) not in resp['list']: + # continue + # value_list = ste_df.iloc[:, -1].to_list() + # resp['list'][str(kk)]['总体']['total'] = int(sum(value_list)) for i in range(len(df)): + if str(df['date'][i]) not in resp['list']: + continue resp['list'][str(df['date'][i])]['总体']['total'] = int(df['values'][i]) # 兼容下载功能 download = analysis.event_view.get('download', '')