data_sql=f"select id,name,unique_tag,uuid,beneficiary,description,create_time, income, output from fi_account where name like '%{name}%' ORDER BY id DESC LIMIT {int(page) - 1},{size}"
data_sql=f"select id,name,unique_tag,uuid,beneficiary,description,create_time, income, output from fi_account ORDER BY id DESC LIMIT {int(page) - 1},{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)} order by id DESC limit {(int(page) - 1) * size},{size}"
count_sql=f"select count(id) as num from v3_guild_account_statistics_copy"
exceptExceptionase:
data_sql=f"select id,initial_money as balance,income,outcome,create_time from v3_guild_account_statistics_copy order by id DESC limit {(int(page) - 1) * size},{size}"
count_sql=f"select count(id) as num from v3_user_account_statistics where type=2 and {' and '.join(condition)}"
data_sql=f"select id,initial_money as balance, income,pay as outcome,date as create_time from v3_user_account_statistics where type=2 and {' and '.join(condition)} order by id DESC limit {(int(page) - 1) * size},{size}"
else:
count_sql=f"select count(id) as num from v3_user_account_statistics where type=2"
data_sql=f"select id,initial_money as balance, income,pay as outcome,date as create_time from v3_user_account_statistics where type=2 order by id DESC limit {(int(page) - 1) * size},{size}"
count_sql=f"select count(id) as num from finance_data_calculation_sum where type=1 and {' and '.join(condition)}"
data_sql=f"select id,initial_money as balance,income,outcome,calculation_time as create_time from finance_data_calculation_sum where type=1 and {' and '.join(condition)} order by id DESC limit {(int(page) - 1) * size},{size}"
else:
count_sql=f"select count(id) as num from finance_data_calculation_sum where type=1"
data_sql=f"select id,initial_money as balance,income,outcome,calculation_time as create_time from finance_data_calculation_sum where type=1 order by id DESC limit {(int(page) - 1) * size},{size}"
count_sql=f"select count(id) as num from finance_data_calculation_sum where type=4 and {' and '.join(condition)}"
data_sql=f"select id,initial_money as balance,income,outcome,calculation_time as create_time from finance_data_calculation_sum where type=4 and {' and '.join(condition)} order by id DESC limit {(int(page) - 1) * size},{size}"
else:
count_sql=f"select count(id) as num from finance_data_calculation_sum where type=4"
data_sql=f"select id,initial_money as balance,income,outcome,calculation_time as create_time from finance_data_calculation_sum where type=4 order by id DESC limit {(int(page) - 1) * size},{size}"
count_sql=f"select count(id) as num from finance_data_calculation_sum where type=5 and {' and '.join(condition)}"
data_sql=f"select id,initial_money as balance,income,outcome,calculation_time as create_time from finance_data_calculation_sum where type=5 and {' and '.join(condition)} order by id DESC limit {(int(page) - 1) * size},{size}"
else:
count_sql=f"select count(id) as num from finance_data_calculation_sum where type=5"
data_sql=f"select id,initial_money as balance,income,outcome,calculation_time as create_time from finance_data_calculation_sum where type=5 order by id DESC limit {(int(page) - 1) * size},{size}"
else:
iffinance_condition:
count_sql=f"select count(id) as num from v2_system_account_statistics where {' and '.join(finance_condition)}"
data_sql=f"select id,initial_money as balance,income,outcome,create_time from v2_system_account_statistics where {' and '.join(finance_condition)} order by id DESC limit {(int(page) - 1) * size},{size}"
else:
count_sql=f"select count(id) as num from v2_system_account_statistics"
data_sql=f"select id,initial_money as balance,income,outcome,create_time from v2_system_account_statistics order by id DESC limit {(int(page) - 1) * size},{size}"
count_sql=f"select count(id) as num from assets_log_{year_month} where {' and '.join(details_condition)}"
serial_info=[i[0].to_dict()foriincondition_data]
data_sql=f"select id,order_number,reference_type,amount/1000 as amount,create_time from assets_log_{year_month} where {' and '.join(details_condition)} order by id DESC limit {(int(page) - 1) * size},{size}"
serial_info.reverse()
amount_sql=f"select sum(cast(amount as decimal(20,6)))/1000 as total_amount from assets_log_{year_month} where {' and '.join(details_condition)}"
exceptExceptionase:
print(e)
else:
return[],0,0ifis_listelse[]
count_sql=f"select count(id) as num from assets_log_{year_month}"
data_sql=f"select id,order_number,reference_type,amount/1000 as amount,create_time from assets_log_{year_month} order by id DESC limit {(int(page) - 1) * size},{size}"
amount_sql=f"select sum(cast(amount as decimal(20,6)))/1000 as total_amount from assets_log_{year_month}"
sql=f"SELECT reference_type, type, SUM(cast(amount as decimal(20,6)))/1000 as money FROM {date} where reference_type='{key_type}' GROUP BY reference_type, type ORDER BY reference_type"
sql=f"SELECT reference_type, type, SUM(cast(amount as decimal(20,6)))/1000 as money FROM {date} where reference_type='{key_type}' GROUP BY reference_type, type ORDER BY reference_type"
ifnameandnotkey_type:
ifnameandnotkey_type:
...
@@ -89,7 +88,7 @@ class CalculationMonthlyBill(object):
...
@@ -89,7 +88,7 @@ class CalculationMonthlyBill(object):
ifnotnameandnotkey_type:
ifnotnameandnotkey_type:
sql=f"SELECT reference_type, type, SUM(cast(amount as decimal(20,6)))/1000 as money FROM {date} GROUP BY reference_type, type ORDER BY reference_type"
sql=f"SELECT reference_type, type, SUM(cast(amount as decimal(20,6)))/1000 as money FROM {date} GROUP BY reference_type, type ORDER BY reference_type"
sql=f"SELECT uuid,reference_type,order_number,order_id,type,cast(amount as decimal(20,6))/1000 as money,amount_type,create_time FROM {date} where order_id={error_list[0]}"
sql=f"SELECT uuid,reference_type,order_number,order_id,type,cast(amount as decimal(20,6))/1000 as money,amount_type,create_time FROM {date} where order_id={error_list[0]}"
...
@@ -155,7 +151,7 @@ class CalculationMonthlyDetails(object):
...
@@ -155,7 +151,7 @@ class CalculationMonthlyDetails(object):
sql=f"SELECT uuid,reference_type,order_number,order_id,type,cast(amount as decimal(20,6))/1000 as money,amount_type,create_time FROM {date} where order_id in({','.join(error_list)})"
sql=f"SELECT uuid,reference_type,order_number,order_id,type,cast(amount as decimal(20,6))/1000 as money,amount_type,create_time FROM {date} where order_id in({','.join(error_list)})"
iflen(error_list)==0:
iflen(error_list)==0:
return[]
return[]
result=LinkMysql(database).query_mysql(sql)
result=LinkMysql(env.DB_HISTORY).query_mysql(sql)
returnresult
returnresult
...
@@ -176,14 +172,12 @@ class MonthDataDerive(object):
...
@@ -176,14 +172,12 @@ class MonthDataDerive(object):
sql=f"SELECT reference_type, type, SUM(cast(amount as decimal(20,6)))/1000 as money FROM {date} where reference_type='{key_type}' GROUP BY reference_type, type ORDER BY reference_type"
sql=f"SELECT reference_type, type, SUM(cast(amount as decimal(20,6)))/1000 as money FROM {date} where reference_type='{key_type}' GROUP BY reference_type, type ORDER BY reference_type"
else:
else:
sql=f"SELECT reference_type, type, SUM(cast(amount as decimal(20,6)))/1000 as money FROM {date} GROUP BY reference_type, type ORDER BY reference_type"
sql=f"SELECT reference_type, type, SUM(cast(amount as decimal(20,6)))/1000 as money FROM {date} GROUP BY reference_type, type ORDER BY reference_type"
count_sql=f"select count(id) as num from guild_margin_history as m where {' and '.join(guild_filters)}"
returndata,count
data_sql=f"select m.id,m.guild_id,g.guild_name,amount,m.status,m.addtime as create_time from guild_margin_history m inner join guild g on m.guild_id=g.id where {' and '.join(guild_filters)} order by id DESC limit {(int(page) - 1) * size},{size}"
else:
count_sql=f"select count(id) as num from guild_margin_history"
defmargin_dispose(db:Session,param):
data_sql=f"select m.id,m.guild_id,g.guild_name,amount,m.status,m.addtime as create_time from guild_margin_history m inner join guild g on m.guild_id=g.id order by id DESC limit {(int(page) - 1) * size},{size}"
guild_sql=f"select id,margin,ice_uuid,guild_level_id,withdrawal_time,pay_status,is_lucky_gift,is_binding,bind_authority,pledge_rate from guild where id={param.guild_id} limit 0,1"
count_sql=f"select count(id) as num from finance_fix_log where {' and '.join(finance_filters)}"
returndata,count
data_sql=f"select id,type,money,unique_tag,amount_type,operator,create_time,remark from finance_fix_log where {' and '.join(finance_filters)} order by id DESC limit {(int(page) - 1) * size},{size}"
else:
count_sql=f"select count(id) as num from finance_fix_log"
data_sql=f"select id,type,money,unique_tag,amount_type,operator,create_time,remark from finance_fix_log order by id DESC limit {(int(page) - 1) * size},{size}"
sum_sql=f"select count(e.id) as num from finance_error_transverse_log as e inner join fi_account as f on e.uuid=f.uuid where {' and '.join(recovery_list)}"
foritemindata:
query_sql=f"select e.id,f.name,e.cont,e.out_money,e.entry_money,e.uuid,e.type,e.create_time,e.from_time from finance_error_transverse_log as e inner join fi_account as f on e.uuid=f.uuid where {' and '.join(recovery_list)} order by e.id DESC limit {(int(params.get('page')) - 1) * params.get('size')},{params.get('size')}"
query_sql=f"select e.id,f.name,e.cont,e.out_money,e.entry_money,e.uuid,e.type,e.create_time,e.from_time from finance_error_transverse_log as e inner join fi_account as f on e.uuid=f.uuid order by e.id DESC limit {(int(params.get('page')) - 1) * params.get('size')},{params.get('size')}"
query_sql=f"select out_money,entry_money,befor_out_money,befor_entry_money from finance_error_transverse_log where uuid='{param.uuid}' and from_time < '{param.from_time}' and type={param.type} ORDER BY id DESC limit 0,1"
query_today_sql=f"select id from finance_error_transverse_log where uuid='{param.uuid}' and from_time = '{param.from_time}' and type={param.type} ORDER BY id DESC limit 0,1"
update_sql=f"update finance_error_transverse_log set uuid='{data.uuid}',type={data.type},out_money={data.out_money},entry_money={data.entry_money},befor_out_money=befor_out_money+{change_out_price},befor_entry_money=befor_entry_money+{change_entry_money},from_time='{data.from_time}',cont='{data.cont}' where id={data.id}"