Commit 4f1a2a43 by 陈森彬

update spider expired rate

parent d2ed3cc3
Showing with 6 additions and 6 deletions
...@@ -108,7 +108,8 @@ class MongoOperator: ...@@ -108,7 +108,8 @@ class MongoOperator:
print(plat, expired, total) print(plat, expired, total)
if msgs: if msgs:
ts = int(time.time()) ts = int(time.time())
mysql_db.insert_expired_data(ts, json.dumps(expired_dict)) for k, v in expired_dict.items():
mysql_db.insert_expired_data(ts, k, v)
return msg return msg
else: else:
return return
......
...@@ -59,10 +59,10 @@ class MySqlOperator: ...@@ -59,10 +59,10 @@ class MySqlOperator:
cursor.execute(sql, (s, u)) cursor.execute(sql, (s, u))
self.db.commit() self.db.commit()
def insert_expired_data(self,time_stamp,platform_data): def insert_expired_data(self, time_stamp, platform, expired_rate):
with self.db.cursor() as cursor: with self.db.cursor() as cursor:
sql = """ sql = """
INSERT INTO lie_spider_expired_rate(time_stamp, platform_data) VALUES (%s, %s) INSERT INTO lie_spider_expired_rate(time_stamp, platform,expired_rate) VALUES (%s,%s,%s)
""" """
cursor.execute(sql,(time_stamp,platform_data)) cursor.execute(sql, (time_stamp, platform, expired_rate))
self.db.commit() self.db.commit()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment