count_sql=f"SELECT count(*) FROM assets_log_{now_month} where {query} and type=1"
count_sql=f"SELECT count(*) FROM assets_log_{now_month} where {query} and reference_type in('picture_scroll_recharge','relic_recharge','userRecharge','pay_discount')"
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}'
sql=f"SELECT id,a.uuid,a.amount,FROM_UNIXTIME(a.create_time,'%Y-%c-%d %h:%i:%s') as payment_time,a.reference_type,a.reference_number FROM assets_log_{now_month} as a where {query} and reference_type in('picture_scroll_recharge','relic_recharge','userRecharge','pay_discount') ORDER BY id desc limit {(int(page) - 1) * size},{size}"
once_res=self.linkmysql.query_mysql(sql)
money_sql=f"SELECT sum(amount) FROM assets_log_{now_month} where {query} and type=1"
money_sql=f"SELECT sum(amount) FROM assets_log_{now_month} where {query} and reference_type in('picture_scroll_recharge','relic_recharge','userRecharge','pay_discount')"
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="SELECT sum(a.b) FROM ("f"SELECT count(*) as b FROM assets_log_{int(now_month[0])} where {(' and '.join(query[0]))} and reference_type in('picture_scroll_recharge','relic_recharge','userRecharge','pay_discount') UNION ALL SELECT count(*) FROM assets_log_{int(now_month[1])} where {(' and '.join(query[1]))} and reference_type in('picture_scroll_recharge','relic_recharge','userRecharge','pay_discount')) 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} 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}'
print(sql)
sql=f"SELECT id,uuid,amount,FROM_UNIXTIME(create_time,'%Y-%c-%d %h:%i:%s') as payment_time,reference_type,reference_number FROM assets_log_{int(now_month[0])} where {query1} and reference_type in('picture_scroll_recharge','relic_recharge','userRecharge','pay_discount') UNION ALL SELECT id,uuid,amount,FROM_UNIXTIME(create_time,'%Y-%c-%d %h:%i:%s') as payment_time,reference_type,reference_number FROM assets_log_{int(now_month[1])} where {query2} and reference_type in('picture_scroll_recharge','relic_recharge','userRecharge','pay_discount') ORDER BY id desc limit {(int(page) - 1) * size},{size}"
once_res=self.linkmysql.query_mysql(sql)
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 "
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 reference_type in('picture_scroll_recharge','relic_recharge','userRecharge','pay_discount') UNION ALL SELECT sum(amount)FROM assets_log_{int(now_month[1])} where {(' and '.join(query[1]))} and reference_type in('picture_scroll_recharge','relic_recharge','userRecharge','pay_discount') ) AS a "
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}'
sql=f"SELECT a.uuid,a.amount,FROM_UNIXTIME(a.create_time,'%Y-%c-%d %h:%i:%s') as payment_time,a.reference_type,a.order_number FROM assets_log_{now_month} as a where {query} and reference_type in('picture_scroll_recharge','relic_recharge','userRecharge','pay_discount')"
once_res=self.linkmysql.query_mysql(sql)
else:
query1=(' and '.join(query[0]))
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}'
sql=f"SELECT id,uuid,amount,FROM_UNIXTIME(create_time,'%Y-%c-%d %h:%i:%s') as payment_time,reference_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,reference_type,order_number FROM assets_log_{int(now_month[1])} where {query2} and reference_type in('picture_scroll_recharge','relic_recharge','userRecharge','pay_discount')"
once_res=self.linkmysql.query_mysql(sql)
returnonce_res
...
...
@@ -184,10 +179,10 @@ class WithdrawStatement(object):
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}'
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.reference_type FROM assets_log_{now_month} as a where {query} ORDER BY id desc limit {(int(page) - 1) * size},{size}'
once_res=self.linkmysql.query_mysql(sql)
money_sql=f"SELECT sum(amount) FROM assets_log_{now_month} where {query} "
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}"
sql=f"SELECT id,uuid,amount,FROM_UNIXTIME(create_time,'%Y-%c-%d %h:%i:%s') as payment_time,reference_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,reference_type,reference_number FROM assets_log_{int(now_month[1])} where {query2} ORDER BY id desc limit {(int(page) - 1) * size},{size}"
once_res=self.linkmysql.query_mysql(sql)
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 "