From 92311d18b3433a39028ca08ba4c4dcff554de6a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F?= <250213850@qq.com> Date: Tue, 27 Sep 2022 10:35:21 +0800 Subject: [PATCH] =?UTF-8?q?1.=E9=99=90=E5=88=B6=E8=BF=94=E5=9B=9E=E5=85=85?= =?UTF-8?q?=E5=80=BC=E6=8E=92=E8=A1=8C=E7=9A=84=E6=95=B0=E9=87=8F300?= =?UTF-8?q?=E6=9D=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api_v1/endpoints/query.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/api/api_v1/endpoints/query.py b/api/api_v1/endpoints/query.py index 5c040a7..5de9242 100644 --- a/api/api_v1/endpoints/query.py +++ b/api/api_v1/endpoints/query.py @@ -453,18 +453,12 @@ async def event_model( for idx, ii in enumerate(idx_list): ad[ii] = res[0][i][idx] res[0][i] = ad - # 计算每一天的总和 - # if res[0]['event_name'] == '充值排行': - # zong=[] - # lens=len(res[0]['date_range']) - # for nu in range(lens): - # aa=0 - # for value in res[0]['values']: - # aa+=value[nu] - # zong.append(aa) - # res[0]['zong']=zong - # else: - # res[0]['zong'] = [] + # 如是充值排行,限制返回300条 + if res[0].get('event_name','') == '充值排行': + res[0]['groups'] = res[0]['groups'][0:300] + res[0]['values'] = res[0]['values'][0:300] + res[0]['sum'] = res[0]['sum'][0:300] + res[0]['avg'] = res[0]['avg'][0:300] return schemas.Msg(code=0, msg='ok', data=res)