This commit is contained in:
lwl0608 2024-05-08 16:43:02 +08:00
parent c7d34d61b4
commit df4b88f9c0
2 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,5 @@
from lib.all import * from lib.all import *
from datetime import datetime
# 流水同比 # 流水同比
@ -20,8 +21,9 @@ class S:
sql = '''select * from vas_yoy_flow order by ptime desc limit 1''' sql = '''select * from vas_yoy_flow order by ptime desc limit 1'''
rows = self.mysql_db_bi.query(sql) rows = self.mysql_db_bi.query(sql)
if len(rows) > 0: if len(rows) > 0:
return rows[0].get("ptime") dt = rows[0].get("ptime")
return "" return dt.timestamp()
return 0
def get_flow(self, st, et): def get_flow(self, st, et):
sql = '''select sum(pay_amount) flow from vas_order where ct>={} and ct<{}'''.format(st, et) sql = '''select sum(pay_amount) flow from vas_order where ct>={} and ct<{}'''.format(st, et)
@ -33,6 +35,8 @@ class S:
def proc(self): def proc(self):
zero_time = get_today_zero_time() - 86400 zero_time = get_today_zero_time() - 86400
last_ptime = self.get_last_ptime() last_ptime = self.get_last_ptime()
if last_ptime == 0:
return
print(zero_time) print(zero_time)
print(last_ptime, type(last_ptime)) print(last_ptime, type(last_ptime))

View File

@ -254,5 +254,3 @@ def dict2json(dic):
if not isinstance(dic, dict): if not isinstance(dic, dict):
return json.dumps({}) return json.dumps({})
return json.dumps(dic, ensure_ascii=False) return json.dumps(dic, ensure_ascii=False)