add bi
This commit is contained in:
parent
2b9b87c57b
commit
c2a4c9bce5
|
@ -0,0 +1,40 @@
|
|||
from lib.all import *
|
||||
|
||||
|
||||
# 流水同比
|
||||
|
||||
class S:
|
||||
def __init__(self):
|
||||
self.mysql_db_vas = Mysql(
|
||||
"rm-bp11t1616a1kjvmx5.mysql.rds.aliyuncs.com", 3306, "vas", "root", "Wishpal2024"
|
||||
)
|
||||
self.mysql_db_bi = Mysql(
|
||||
"1Panel-mysql-TUA1", 3306, "metabase_bi", "metabase_bi", "Wishpal_2024"
|
||||
)
|
||||
|
||||
def __del__(self):
|
||||
self.mysql_db_vas.close()
|
||||
self.mysql_db_bi.close()
|
||||
|
||||
def get_last_ptime(self):
|
||||
sql = '''select * from vas_yoy_flow order by ptime desc limit 1'''
|
||||
rows = self.mysql_db_vas.query(sql)
|
||||
if len(rows) > 0:
|
||||
return rows[0].get("ptime")
|
||||
return ""
|
||||
|
||||
def get_flow(self, st, et):
|
||||
sql = '''select sum(pay_amount) flow from vas_order where ct>={} and ct<{}'''.format(st, et)
|
||||
rows = self.mysql_db_vas.query(sql)
|
||||
if len(rows) > 0:
|
||||
return safe_get_int(rows[0], "flow")
|
||||
return 0
|
||||
|
||||
def proc(self):
|
||||
zero_time = get_today_zero_time() - 86400
|
||||
|
||||
print(zero_time)
|
||||
|
||||
|
||||
s = S()
|
||||
s.proc()
|
Loading…
Reference in New Issue