This commit is contained in:
lwl0608 2024-05-08 16:59:35 +08:00
parent 95a8f78893
commit 23d78f35c3
1 changed files with 6 additions and 2 deletions

View File

@ -32,17 +32,21 @@ class S:
return safe_get_int(rows[0], "flow")
return 0
def insert_flow(self, ptime, flow):
sql = '''insert into vas_yoy_flow (ptime, flow) values ({}, {})'''.format(ptime, flow)
return self.mysql_db_bi.exec(sql, ())
def proc(self):
time_now = int(time.time())
zero_time = get_today_zero_time() - 86400
last_time = self.get_last_ptime()
last_time = get_today_zero_time() - 86400
while last_time <= get_today_zero_time():
next_time = last_time + 300
flow = self.get_flow(zero_time, next_time)
self.insert_flow(get_time_str_by_ts(next_time), flow)
print(get_time_str_by_ts(next_time), flow)
last_time += 300
time.sleep(0.5)