add bi
This commit is contained in:
parent
95a8f78893
commit
23d78f35c3
|
@ -32,17 +32,21 @@ class S:
|
||||||
return safe_get_int(rows[0], "flow")
|
return safe_get_int(rows[0], "flow")
|
||||||
return 0
|
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):
|
def proc(self):
|
||||||
time_now = int(time.time())
|
time_now = int(time.time())
|
||||||
zero_time = get_today_zero_time() - 86400
|
zero_time = get_today_zero_time() - 86400
|
||||||
last_time = self.get_last_ptime()
|
last_time = self.get_last_ptime()
|
||||||
|
|
||||||
last_time = get_today_zero_time() - 86400
|
|
||||||
|
|
||||||
while last_time <= get_today_zero_time():
|
while last_time <= get_today_zero_time():
|
||||||
next_time = last_time + 300
|
next_time = last_time + 300
|
||||||
flow = self.get_flow(zero_time, next_time)
|
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)
|
print(get_time_str_by_ts(next_time), flow)
|
||||||
|
|
||||||
last_time += 300
|
last_time += 300
|
||||||
time.sleep(0.5)
|
time.sleep(0.5)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue