Commit 4f1a2a43 by 陈森彬

update spider expired rate

parent d2ed3cc3
Showing with 6 additions and 6 deletions
......@@ -108,7 +108,8 @@ class MongoOperator:
print(plat, expired, total)
if msgs:
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
else:
return
......
......@@ -59,10 +59,10 @@ class MySqlOperator:
cursor.execute(sql, (s, u))
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:
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))
self.db.commit()
\ No newline at end of file
cursor.execute(sql, (time_stamp, platform, expired_rate))
self.db.commit()
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