Commit 1f8fe5d0 authored by xianyang's avatar xianyang

账户第四层添加字段

parent dff71fda
......@@ -243,10 +243,10 @@ def get_finance_info(unique_tag, id, page, size, start_time, end_time, is_list=N
if finance_condition:
conditions = [i.replace('create_time', 'date') for i in finance_condition]
count_sql = f"select date as create_time from v3_user_account_statistics where {' and '.join(conditions)} GROUP BY date"
data_sql = f"select id,initial_money as balance,income,pay as outcome,date as create_time,balance as consumable,pearl as can_withdraw from v3_user_account_statistics where {' and '.join(conditions)} GROUP BY date order by date DESC limit {(int(page) - 1) * size},{size}"
data_sql = f"select id,initial_money as balance,income,pay as outcome,date as create_time from v3_user_account_statistics where {' and '.join(conditions)} GROUP BY date order by date DESC limit {(int(page) - 1) * size},{size}"
else:
count_sql = f"select date as create_time from v3_user_account_statistics GROUP BY date"
data_sql = f"select id,initial_money as balance,income,pay as outcome,date as create_time,balance as consumable,pearl as can_withdraw from v3_user_account_statistics GROUP BY date order by date DESC limit {(int(page) - 1) * size},{size}"
data_sql = f"select id,initial_money as balance,income,pay as outcome,date as create_time from v3_user_account_statistics GROUP BY date order by date DESC limit {(int(page) - 1) * size},{size}"
if unique_tag == 'user_account':
finance_condition.append('type=1')
condition = [i.replace('create_time', 'calculation_time') for i in finance_condition]
......@@ -654,7 +654,7 @@ def delete_guild_specify_field(data):
class SpecificAccountQuery(object):
"""账户用户,背包,公会第四层查询"""
def __init__(self, page, size, uuid, time, type, reference_type, unique_tag, guild_id):
def __init__(self, page, size, uuid, time, type, reference_type, unique_tag, guild_id, amount_type):
self.page = page
self.size = size
self.uuid = uuid
......@@ -664,6 +664,7 @@ class SpecificAccountQuery(object):
self._type = type
self.reference_type = reference_type
self.unique_tag = unique_tag
self.amount_type = amount_type
self.total_list = []
def condition_query(self, date, cond_list):
......@@ -679,6 +680,8 @@ class SpecificAccountQuery(object):
if not guild_data:
return [], 0, 0
self.uuid = guild_data[0]['uuid']
if self.amount_type:
condition.append(f" amount_type='{self.amount_type}'")
condition.append(f" uuid='{self.uuid}'")
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 # 结束时间那天包含在内,固小于第二天凌晨
......
......@@ -129,12 +129,13 @@ def finance_fourth_info(page: int,
type: Optional[int] = None,
gift_type: Optional[str] = "",
unique_tag: Optional[str] = "",
amount_type: Optional[str] = "",
token=Depends(login_required)):
"""账户财务明细 第四层"""
if not all([time, unique_tag]):
return HttpResultResponse(code=500, msg="缺少必传参数")
res, total, count = SpecificAccountQuery(page, size, uuid, time, type, gift_type, unique_tag,
guild_id).business_logic()
guild_id, amount_type).business_logic()
return HttpResultResponse(total=total, data=res, count=count)
......
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