sql=f'SELECT d.id as order_number,d.userid as user_id,u.user_number,u.nick_name,d.money,d.paychannel as pay_channel,d.sid,d.current,FROM_UNIXTIME(d.payment_time,"%Y-%c-%d %h:%i:%s") as payment_time,FROM_UNIXTIME(d.lastupdate,"%Y-%c-%d %h:%i:%s") as last_update FROM `orders` as d inner join v2_user as u on d.userid=u.user_id where status=1 ORDER BY id desc limit {page},{(size)}'
once_res=self.linkmysql.query_mysql(sql)
money_sql=f'SELECT sum(d.balanceadd) FROM `orders` as d inner join v2_user as u on d.userid=u.user_id where status=1'
sql=f'SELECT d.id as order_number,d.userid as user_id,u.user_number,u.nick_name,d.money,d.paychannel as pay_channel,d.sid,d.current,FROM_UNIXTIME(d.payment_time,"%Y-%c-%d %h:%i:%s") as payment_time,FROM_UNIXTIME(d.lastupdate,"%Y-%c-%d %h:%i:%s") as last_update FROM `orders` as d inner join v2_user as u on d.userid=u.user_id where status=1 ORDER BY id desc limit {(int(page) - 1) * size},{size}'
sql=f'SELECT id,a.uuid,a.amount,FROM_UNIXTIME(a.create_time,"%Y-%c-%d %h:%i:%s") as payment_time,a.amount_type,a.reference_number FROM assets_log_{now_month} as a where type=1 and {query} ORDER BY id desc limit {(int(page) - 1) * size},{size}'
once_res=self.linkmysql.query_mysql(sql)
once_res=self.linkmysql.query_mysql(sql)
money_sql=f"SELECT sum(d.balanceadd) FROM `orders` as d inner join v2_user as u on d.userid=u.user_id where status=1"
money_sql=f"SELECT sum(amount) FROM assets_log_{now_month} where {query} and type=1"
query=' and '.join(query).replace('lastupdate','d.lastupdate').replace('current','d.current')
count_sql="SELECT sum(a.b) FROM ("f"SELECT count(*) as b FROM assets_log_{int(now_month[0])} where {(' and '.join(query[0]))} and type=1 UNION ALL SELECT count(*) FROM assets_log_{int(now_month[1])} where {(' and '.join(query[1]))} and type=1 ) AS a "
count_sql=f"SELECT count(*) FROM `orders` as d inner join v2_user as u on d.userid=u.user_id where status=1 and {query}"
sql=f'SELECT d.id as order_number,d.userid as user_id,u.user_number,u.nick_name,d.money,d.paychannel as pay_channel,d.sid,d.current,FROM_UNIXTIME(d.payment_time,"%Y-%c-%d %h:%i:%s") as payment_time,FROM_UNIXTIME(d.lastupdate,"%Y-%c-%d %h:%i:%s") as last_update FROM `orders` as d inner join v2_user as u on d.userid=u.user_id where status=1 and {query} ORDER BY id desc limit {(int(page) - 1) * size},{size}'
query2=(' and '.join(query[1]))
once_res=self.linkmysql.query_mysql(sql)
sql=f'SELECT id,uuid,amount,FROM_UNIXTIME(create_time,"%Y-%c-%d %h:%i:%s") as payment_time,amount_type,reference_number FROM assets_log_{int(now_month[0])} where {query1} and type=1 UNION ALL SELECT id,uuid,amount,FROM_UNIXTIME(create_time,"%Y-%c-%d %h:%i:%s") as payment_time,amount_type,reference_number FROM assets_log_{int(now_month[1])} where {query2} and type=1 ORDER BY id desc limit {(int(page) - 1) * size},{size}'
money_sql=f"SELECT sum(d.balanceadd) FROM `orders` as d inner join v2_user as u on d.userid=u.user_id where status=1 and {query}"
money_sql=f"SELECT sum(a.b) FROM ("f"SELECT sum(amount) as b FROM assets_log_{int(now_month[0])} where {(' and '.join(query[0]))} and type=1 UNION ALL SELECT sum(amount)FROM assets_log_{int(now_month[1])} where {(' and '.join(query[1]))} and type=1 ) AS a "
@@ -156,22 +133,39 @@ class RechargeStatement(object):
...
@@ -156,22 +133,39 @@ class RechargeStatement(object):
query.append(f"user_id={data.user_id} ")
query.append(f"user_id={data.user_id} ")
elifdata.sid:
elifdata.sid:
query.append(f"sid='{data.sid}' ")
query.append(f"sid='{data.sid}' ")
ifquery==[]:
ifdata.month_type==1:
sql=f'SELECT d.id as order_number,d.userid as user_id,u.user_number,u.nick_name,d.money,d.paychannel as pay_channel,d.sid,d.current,FROM_UNIXTIME(d.payment_time,"%Y-%c-%d %h:%i:%s") as payment_time,FROM_UNIXTIME(d.lastupdate,"%Y-%c-%d %h:%i:%s") as last_update FROM `orders` as d inner join v2_user as u on d.userid=u.user_id where status=1 ORDER BY id desc'
sql=f'SELECT a.uuid,a.amount,FROM_UNIXTIME(a.create_time,"%Y-%c-%d %h:%i:%s") as payment_time,a.amount_type,a.order_number FROM assets_log_{now_month} as a where type=1 and {query}'
once_res=self.linkmysql.query_mysql(sql)
once_res=self.linkmysql.query_mysql(sql)
else:
else:
query=' and '.join(query)
query1=(' and '.join(query[0]))
sql=f'SELECT d.id as order_number,d.userid as user_id,u.user_number,u.nick_name,d.money,d.paychannel as pay_channel,d.sid,d.current,FROM_UNIXTIME(d.payment_time,"%Y-%c-%d %h:%i:%s") as payment_time,FROM_UNIXTIME(d.lastupdate,"%Y-%c-%d %h:%i:%s") as last_update FROM `orders` as d inner join v2_user as u on d.userid=u.user_id where status=1 and {query} ORDER BY id desc'
query2=(' and '.join(query[1]))
sql=f'SELECT id,uuid,amount,FROM_UNIXTIME(create_time,"%Y-%c-%d %h:%i:%s") as payment_time,amount_type,order_number FROM assets_log_{int(now_month[0])} where {query1} UNION ALL SELECT id,uuid,amount,FROM_UNIXTIME(create_time,"%Y-%c-%d %h:%i:%s") as payment_time,amount_type,order_number FROM assets_log_{int(now_month[1])} where {query2}'
once_res=self.linkmysql.query_mysql(sql)
once_res=self.linkmysql.query_mysql(sql)
returnonce_res
returnonce_res
classWithdrawStatement(object):
classWithdrawStatement(object):
"""提现报表"""
"""提现报表"""
def__init__(self):
def__init__(self):
self.derive_user_list=[]
self.derive_user_list=[]
self.linkmysql=LinkMysql(env.DB_3YV2)
self.linkmysql=LinkMysql(env.DB_HISTORY)
self.derive_guild_list=[]
self.derive_guild_list=[]
defthread_to_data(self,db,num):
defthread_to_data(self,db,num):
...
@@ -184,169 +178,82 @@ class WithdrawStatement(object):
...
@@ -184,169 +178,82 @@ class WithdrawStatement(object):
sql=f'SELECT t.usernumber as user_number,t.status,t.id as bank_code,t.nickname as nick_name,t.truename as true_name ,t.money,t.current,t.final_money,t.idcard as id_card,t.account,t.platformServiceFee as platform_service_fee,t.thirdServiceFee as third_service_fee FROM `tixian_order` as t where choice={choice} ORDER BY id desc limit {(int(page) - 1) * size},{size}'
sql=f'SELECT t.usernumber as user_number,t.status,t.id as bank_code,t.nickname as nick_name,t.truename as true_name ,t.money,t.current,t.final_money,t.idcard as id_card,t.account,t.platformServiceFee as platform_service_fee,t.thirdServiceFee as third_service_fee FROM `tixian_order` as t where choice={choice} and {query} ORDER BY id desc limit {(int(page) - 1) * size},{size}'
sql=f'SELECT uuid,a.reference_type,a.reference_number,FROM_UNIXTIME(a.create_time,"%Y-%c-%d %h:%i:%s") as payment_time,a.amount_type FROM assets_log_{now_month} as a where {query} ORDER BY id desc limit {(int(page) - 1) * size},{size}'
# for i in once_res:
once_res=self.linkmysql.query_mysql(sql)
# info_dict = i.to_dict()
money_sql=f"SELECT sum(amount) FROM assets_log_{now_month} where {query} "
count_sql="SELECT sum(a.b) FROM ("f"SELECT count(*) as b FROM assets_log_{int(now_month[0])} where {(' and '.join(query[0]))} UNION ALL SELECT count(*) FROM assets_log_{int(now_month[1])} where {(' and '.join(query[1]))}) AS a "
sql=f"SELECT id,uuid,amount,FROM_UNIXTIME(create_time,'%Y-%c-%d %h:%i:%s') as payment_time,amount_type,reference_number FROM assets_log_{int(now_month[0])} where {query1} UNION ALL SELECT id,uuid,amount,FROM_UNIXTIME(create_time,'%Y-%c-%d %h:%i:%s') as payment_time,amount_type,reference_number FROM assets_log_{int(now_month[1])} where {query2} ORDER BY id desc limit {(int(page) - 1) * size},{size}"
money_sql=f"SELECT sum(a.b) FROM ("f"SELECT sum(amount) as b FROM assets_log_{int(now_month[0])} where {(' and '.join(query[0]))} UNION ALL SELECT sum(amount)FROM assets_log_{int(now_month[1])} where {(' and '.join(query[1]))} ) AS a "
sql=f'SELECT t.guild_id,t.parent_id as merchants_id,g.guild_name,t.money,t.account,t.`status`,t.finalMoney as final_money,t.update_time,t.taxRate as platform_service_fee,t.thirdServiceFee as third_service_fee FROM `guild_ti_xian` as t inner join guild as g on g.id=t.guild_id ORDER BY t.id desc limit {(int(page) - 1) * size},{size}'
query_time=' and '.join(query).replace('create_time','t.create_time').replace('update_time','t.update_time').replace('guild_id','t.guild_id').replace('status','t.status')
now_month=get_month_last_month(month_type)
count_sql=f'SELECT count(*) FROM `guild_ti_xian` where {query1}'
sql=f'SELECT t.guild_id,t.parent_id as merchants_id,g.guild_name,t.money,t.account,t.`status`,t.finalMoney as final_money,t.update_time,t.taxRate as platform_service_fee,t.thirdServiceFee as third_service_fee FROM `guild_ti_xian` as t inner join guild as g on g.id=t.guild_id where {query_time} ORDER BY t.id desc limit {(int(page) - 1) * size},{size}'
count_sql=f"select count(id) as num from finance_fix_log where {' and '.join(finance_filters)}"
count_sql=f"select count(id) as num from finance_fix_log where {' and '.join(finance_filters)}"
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}"
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:
else:
count_sql=f"select count(id) as num from finance_fix_log"
count_sql=f"select count(id) as num from finance_fix_log where {' and '.join(finance_filters)}"
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}"
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}"