Commit e47d5623 authored by xianyang's avatar xianyang

优化测试账户数据查询

parent 967b67bb
......@@ -279,7 +279,7 @@ class AccountStatistics(object):
def business_query(self, date, condition):
"""业务数据查询"""
if self.unique in ["user_account", "guild_account", "knapsack_account"]:
u_sql = f"select uuid,type,reference_type,SUM(cast(amount as decimal(20,6)))/1000 as amount,create_time,amount_type from {date} WHERE {' and '.join(condition)} GROUP BY uuid,type ORDER BY create_time DESC"
u_sql = f"select uuid,type,reference_type,SUM(cast(amount as decimal(20,6)))/1000 as amount,create_time,amount_type from {date} WHERE {' and '.join(condition)} GROUP BY uuid,type,reference_type,amount_type ORDER BY create_time DESC"
else:
if condition:
u_sql = f"select id,uuid,order_number,type,reference_type,amount/1000 as amount,create_time from {date} WHERE {' and '.join(condition)} ORDER BY create_time DESC"
......@@ -384,7 +384,7 @@ class SpecificAccountQuery(object):
self.uuid = uuid
self.start_time = time
self.end_time = time
self.type = type
self._type = type
self.reference_type = reference_type
self.total_list = []
......@@ -400,6 +400,10 @@ class SpecificAccountQuery(object):
condition.append(f" create_time >= {time_str_to_timestamp(self.start_time + ' 00:00:00')}")
end_time = time_str_to_timestamp(self.end_time + ' 00:00:00') + 86400 # 结束时间那天包含在内,固小于第二天凌晨
condition.append(f" create_time < {end_time}")
if self._type == 1 or self._type == 0:
condition.append(f" type={self._type}")
if self.reference_type:
condition.append(f" reference_type='{self.reference_type}'")
month, last_month, before_last_month = get_last_month()
with ThreadPoolExecutor(max_workers=3) as pool:
future1 = pool.submit(self.condition_query, 'assets_log_' + month, condition)
......
......@@ -101,7 +101,7 @@ def month_to_export(param: schemas.MonthStatistics, request: Request, token=Depe
@router.get("/referenceType/total")
def reference_type_total(date: str, type: str, page: int, size: int, token=Depends(login_required)):
def reference_type_total(date: str, type: str, token=Depends(login_required)):
"""消费类型分类汇总"""
if not all([date, type]):
return HttpResultResponse(code=500, msg='缺少必传参数')
......
......@@ -6,7 +6,7 @@ TYPE_NAME = {
"userExchange": "珍珠兑换钻石(用户)",
"userRecharge": "充值",
"pay_discount": "充值-折扣",
"studioGift": "背包/直播间送礼",
"studioGift": "直播间送礼",
"turntableIncome": "转盘",
"turntableExpend": "转盘-中奖",
"recyclingGifts": "回收礼物",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment