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 "
count_sql="SELECT sum(a.b) FROM ("f"SELECT count(*) as b FROM assets_log_{int(now_month[0])} where {(' and '.join(query))} UNION ALL SELECT count(*) FROM assets_log_{int(now_month[1])} where {(' and '.join(query))}) AS a "
sql=f"SELECT id,uuid,amount,amount_type, 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,amount_type FROM assets_log_{int(now_month[1])} where {query2} ORDER BY id desc limit {(int(page) - 1) * size},{size}"
print(sql)
sql=f"SELECT id,uuid,amount,amount_type, 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 {(' and '.join(query))} UNION ALL SELECT id,uuid,amount,FROM_UNIXTIME(create_time,'%Y-%c-%d %h:%i:%s') as payment_time,reference_type,reference_number,amount_type FROM assets_log_{int(now_month[1])} where {(' and '.join(query))} 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 "
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))} UNION ALL SELECT sum(amount)FROM assets_log_{int(now_month[1])} where {(' and '.join(query))} ) AS a "
payment_sql=f"insert into payment_log(cont,money,create_time,url,uuid) values('{data.cont}','{data.money}',{get_now_timestamp()},'{data.url}','{data.uuid}')"