count_sql=f"select create_time from v3_guild_account_statistics_copy where {' and '.join(finance_condition)} GROUP BY create_time"
count_sql=f"select create_time from v3_guild_account_statistics_copy where {' and '.join(finance_condition)} GROUP BY create_time"
data_sql=f"select id,initial_money as balance,income,outcome,create_time from v3_guild_account_statistics_copy where {' and '.join(finance_condition)} GROUP BY create_time order by create_time DESC limit {(int(page) - 1) * size},{size}"
data_sql=f"select id,initial_money as balance,income,outcome,create_time from v3_guild_account_statistics_copy where {' and '.join(finance_condition)} GROUP BY create_time order by create_time limit {(int(page) - 1) * size},{size}"
else:
other_sql=f"select initial_money as balance,income,outcome,create_time,amount_type from v3_guild_account_statistics_copy where amount_type != 1"
count_sql=f"select create_time from v3_guild_account_statistics_copy GROUP BY create_time"
data_sql=f"select id,initial_money as balance,income,outcome,create_time from v3_guild_account_statistics_copy GROUP BY create_time order by create_time DESC limit {(int(page) - 1) * size},{size}"
ifunique_tag=='anchor_account':
ifunique_tag=='anchor_account':
iffinance_condition:
iffinance_condition:
count_sql=f"select date as create_time from v3_user_account_statistics where {' and '.join(finance_condition)} GROUP BY date"
data_sql=f"select id,initial_money as balance,income,outcome,date as create_time from v3_user_account_statistics where {' and '.join(finance_condition)} GROUP BY date order by date limit {(int(page) - 1) * size},{size}"
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 from v3_user_account_statistics where {' and '.join(conditions)} GROUP BY date order by date limit {(int(page) - 1) * size},{size}"
else:
else:
count_sql=f"select date as create_time from v3_user_account_statistics GROUP BY date"
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 from v3_user_account_statistics GROUP BY date order by date 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 limit {(int(page) - 1) * size},{size}"
count_sql=f"select calculation_time from finance_data_calculation_sum_copy where type=1 and {' and '.join(condition)} GROUP BY calculation_time"
other_sql=f"select initial_money as balance,income,outcome,calculation_time as create_time,amount_type from finance_data_calculation_sum_copy where {' and '.join(condition)} and amount_type != 1"
data_sql=f"select id,initial_money as balance,income,outcome,calculation_time as create_time from finance_data_calculation_sum_copy where type=1 and {' and '.join(condition)} GROUP BY calculation_time order by calculation_time DESC limit {(int(page) - 1) * size},{size}"
condition.append('amount_type=1')
else:
count_sql=f"select calculation_time from finance_data_calculation_sum_copy where {' and '.join(condition)} GROUP BY calculation_time"
count_sql=f"select calculation_time from finance_data_calculation_sum_copy where type=1 GROUP BY calculation_time"
data_sql=f"select id,initial_money as balance,income,outcome,calculation_time as create_time from finance_data_calculation_sum_copy where {' and '.join(condition)} GROUP BY calculation_time order by calculation_time limit {(int(page) - 1) * size},{size}"
data_sql=f"select id,initial_money as balance,income,outcome,calculation_time as create_time from finance_data_calculation_sum_copy where type=1 GROUP BY calculation_time order by calculation_time DESC limit {(int(page) - 1) * size},{size}"
count_sql=f"select calculation_time from finance_data_calculation_sum_copy where type=4 and {' and '.join(condition)} GROUP BY calculation_time"
count_sql=f"select calculation_time from finance_data_calculation_sum_copy where type=4 and {' and '.join(condition)} GROUP BY calculation_time"
data_sql=f"select id,initial_money as balance,income,outcome,calculation_time as create_time from finance_data_calculation_sum_copy where type=4 and {' and '.join(condition)} GROUP BY calculation_time order by calculation_time DESC limit {(int(page) - 1) * size},{size}"
data_sql=f"select id,initial_money as balance,income,outcome,calculation_time as create_time from finance_data_calculation_sum_copy where type=4 and {' and '.join(condition)} GROUP BY calculation_time order by calculation_time limit {(int(page) - 1) * size},{size}"
else:
count_sql=f"select calculation_time from finance_data_calculation_sum_copy where type=4 GROUP BY calculation_time"
data_sql=f"select id,initial_money as balance,income,outcome,calculation_time as create_time from finance_data_calculation_sum_copy where type=4 GROUP BY calculation_time order by calculation_time DESC limit {(int(page) - 1) * size},{size}"
count_sql=f"select calculation_time from finance_data_calculation_sum_copy where type=5 and {' and '.join(condition)} GROUP BY calculation_time"
count_sql=f"select calculation_time from finance_data_calculation_sum_copy where type=5 and {' and '.join(condition)} GROUP BY calculation_time"
data_sql=f"select id,initial_money as balance,income,outcome,calculation_time as create_time from finance_data_calculation_sum_copy where type=5 and {' and '.join(condition)} GROUP BY calculation_time order by calculation_time DESC limit {(int(page) - 1) * size},{size}"
data_sql=f"select id,initial_money as balance,income,outcome,calculation_time as create_time from finance_data_calculation_sum_copy where type=5 and {' and '.join(condition)} GROUP BY calculation_time order by calculation_time limit {(int(page) - 1) * size},{size}"
else:
count_sql=f"select calculation_time from finance_data_calculation_sum_copy where type=5 GROUP BY calculation_time"
data_sql=f"select id,initial_money as balance,income,outcome,calculation_time as create_time from finance_data_calculation_sum_copy where type=5 GROUP BY calculation_time order by calculation_time DESC limit {(int(page) - 1) * size},{size}"
sys_sql=f"select initial_money as balance,income,outcome,create_time from v2_system_account_statistics_copy where fi_account_id={id} and {' and '.join(finance_condition)} ORDER BY create_time DESC"
sys_sql=f"select initial_money as balance,income,outcome,create_time from v2_system_account_statistics_copy where fi_account_id={id} and {' and '.join(finance_condition)} ORDER BY create_time "
else:
sys_sql=f"select initial_money as balance,income,outcome,create_time from v2_system_account_statistics_copy where fi_account_id={id} ORDER BY create_time DESC"
u_sql=f"select uuid,type,SUM(cast(amount as decimal(20,6)))/1000 as amount,FROM_UNIXTIME(create_time,'%Y%c%d') as create_time from {date} WHERE {' and '.join(condition)} GROUP BY uuid,type,FROM_UNIXTIME(create_time,'%Y%c%d')"
u_sql=f"select uuid,type,amount_type,SUM(cast(amount as decimal(20,6)))/1000 as amount,FROM_UNIXTIME(create_time,'%Y%c%d') as create_time from {date} WHERE {' and '.join(condition)} GROUP BY uuid,type,FROM_UNIXTIME(create_time,'%Y%c%d')"
else:
else:
ifself.uuid:
ifself.uuid:
condition.append(f" uuid='{self.uuid}'")
condition.append(f" uuid='{self.uuid}'")
ifcondition:
ifcondition:
u_sql=f"select id,uuid,order_number,type,reference_type,amount/1000 as amount,reference_number,create_time from {date} WHERE {' and '.join(condition)} ORDER BY create_time DESC"
u_sql=f"select id,uuid,order_number,amount_type,type,reference_type,amount/1000 as amount,reference_number,create_time from {date} WHERE {' and '.join(condition)} ORDER BY create_time DESC"
else:
else:
u_sql=f"select id,uuid,order_number,type,reference_type,amount/1000 as amount,reference_number,create_time from {date} ORDER BY create_time DESC"
u_sql=f"select id,uuid,order_number,amount_type,type,reference_type,amount/1000 as amount,reference_number,create_time from {date} ORDER BY create_time DESC"
sql=f"select guild_id,initial_money,income,outcome,create_time from v3_guild_account_detail_copy where {' and '.join(guild_cond_list)} order by create_time DESC"
other_sql=f"select guild_id,initial_money as balance,income,outcome,create_time,amount_type from v3_guild_account_detail_copy where {' and '.join(guild_cond_list)} and amount_type != 1"
sql=f"select guild_id,initial_money,income,outcome,amount_type,create_time from v3_guild_account_detail_copy where {' and '.join(guild_cond_list)} order by create_time DESC"
@@ -675,6 +773,7 @@ class HomePageDisplay(object):
...
@@ -675,6 +773,7 @@ class HomePageDisplay(object):
guild_data=future2.result()
guild_data=future2.result()
account=[i['uuid']foriinacc_data]
account=[i['uuid']foriinacc_data]
guild=[i['uuid']foriinguild_data]
guild=[i['uuid']foriinguild_data]
Logger(20).logger.info("系统,公会账户查询完毕!!")
assets_cond=[]
assets_cond=[]
ifself.unique_tag=='guild_account':
ifself.unique_tag=='guild_account':
assets_cond.append(f" uuid in{tuple(guild)}")
assets_cond.append(f" uuid in{tuple(guild)}")
...
@@ -690,26 +789,30 @@ class HomePageDisplay(object):
...
@@ -690,26 +789,30 @@ class HomePageDisplay(object):
Logger(20).logger.info('没找到系统账户')
Logger(20).logger.info('没找到系统账户')
return[],0,0
return[],0,0
assets_cond.append(f" uuid='{acc_uuid[0]}'")
assets_cond.append(f" uuid='{acc_uuid[0]}'")
assets_sql=f"select reference_type,type,sum(amount) as amount from {self.date} where {' and '.join(assets_cond)} GROUP BY reference_type,type"
Logger(20).logger.info("查询数据中!!!!")
assets_sql=f"select reference_type,type,sum(cast(amount as decimal(20,6))) as amount from assets_log_{self.date} where {' and '.join(assets_cond)} GROUP BY reference_type,type"
@@ -82,12 +82,12 @@ class CalculationMonthlyBill(object):
...
@@ -82,12 +82,12 @@ class CalculationMonthlyBill(object):
self.structure_key=[]
self.structure_key=[]
self.query_data=[]
self.query_data=[]
defthead_task(self,as_list,page,size):
defthead_task(self,page,size):
ifas_list:
q_sql=f"SELECT reference_type, type, sum(cast(amount as decimal(20,3))) as money FROM (select reference_type,type,amount FROM {self.date} where {' and '.join(as_list)} limit {page},{size}) as a GROUP BY reference_type,type ORDER BY reference_type"
q_sql=f"SELECT reference_type, type, sum(cast(amount as decimal(20,3))) as money FROM (select reference_type,type,amount FROM {self.date} limit {page},{size}) as a GROUP BY reference_type, type ORDER BY reference_type"
else:
q_sql=f"SELECT reference_type, type, sum(cast(amount as decimal(20,3))) as money FROM (select reference_type,type,amount FROM {self.date} limit {page},{size}) as a GROUP BY reference_type, type ORDER BY reference_type"
o_sql=f"SELECT o.id,o.money,o.userid,v.nick_name,o.status,o.paychannel,o.sid,o.current FROM orders as o LEFT JOIN v2_user as v on o.userid=v.user_id where o.id={self.order_id[0]}"
else:
o_sql=f"SELECT o.id,o.money,o.userid,v.nick_name,o.status,o.paychannel,o.sid,o.current FROM orders as o LEFT JOIN v2_user as v on o.userid=v.user_id where o.id in{tuple(self.order_id)}"
or_sql=f"SELECT o.userid,v.nick_name,o.money,o.status,o.paychannel,o.sid,o.lastupdate FROM orders as o LEFT JOIN v2_user as v on o.userid=v.user_id WHERE {' and '.join(query)}"
gu_sql=f"select t.userid,t.usernumber,t.nickname,t.current,t.update_time,t.money,t.final_money,g.guild_name from tixian_order as t LEFT JOIN guild as g on t.guild_id=g.id where t.userid in{tuple(user_ids)} and {(' and '.join(condition))}"
else:
gu_sql=f"select t.userid,t.usernumber,t.nickname,t.current,t.update_time,t.money,t.final_money,g.guild_name from tixian_order as t LEFT JOIN guild as g on t.guild_id=g.id where t.userid in{tuple(user_ids)}"
gui_sql=f"SELECT g.id,g.guild_name,g.uuid,t.withdrawal_time,t.update_time,t.money,t.dec_money,t.finalMoney from guild_ti_xian as t LEFT JOIN guild as g on t.guild_id=g.id where {(' and '.join(guild_query))}"
else:
gui_sql="SELECT g.id,g.guild_name,g.uuid,t.withdrawal_time,t.update_time,t.money,t.dec_money,t.finalMoney from guild_ti_xian as t LEFT JOIN guild as g on t.guild_id=g.id"
data_sql=f"SELECT uuid,amount,FROM_UNIXTIME(create_time) as payment_time,reference_type,reference_number,channel,business_number FROM recharge_log_{time_list[0]} where {' and '.join(conditions)} ORDER BY payment_time desc limit {(int(self.page) - 1) * self.size},{self.size}"
money_sql=f"SELECT sum(amount) as m_sum FROM recharge_log_{time_list[0]} where {' and '.join(conditions)}"
count_sql=f"SELECT count(id) as c_sum FROM recharge_log_{time_list[0]} where {' and '.join(conditions)}"
else:
data_sql=f"SELECT uuid,amount,FROM_UNIXTIME(create_time) as payment_time,reference_type,reference_number,channel,business_number FROM recharge_log_{time_list[0]} where {' and '.join(conditions)} UNION ALL SELECT uuid,amount,FROM_UNIXTIME(create_time) as payment_time,reference_type,reference_number,channel,business_number FROM recharge_log_{time_list[1]} where {' and '.join(conditions)} ORDER BY payment_time desc limit {(self.page - 1) * self.size},{self.size}"
money_sql=f"SELECT sum(a.b) as m_sum FROM ("f"SELECT sum(amount) as b FROM recharge_log_{int(time_list[0])} where {' and '.join(conditions)} UNION ALL SELECT sum(amount)FROM recharge_log_{int(time_list[1])} where {' and '.join(conditions)}) AS a "
count_sql="SELECT sum(a.b) as c_sum FROM ("f"SELECT count(id) as b FROM recharge_log_{int(time_list[0])} where {' and '.join(conditions)} UNION ALL SELECT count(id) FROM recharge_log_{int(time_list[1])} where {' and '.join(conditions)}) AS a "