Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lichenggang
/
tas_monitor
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4f1a2a43
authored
Mar 12, 2020
by
陈森彬
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update spider expired rate
parent
d2ed3cc3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
utils/mongo.py
utils/mysql.py
utils/mongo.py
View file @
4f1a2a43
...
...
@@ -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
...
...
utils/mysql.py
View file @
4f1a2a43
...
...
@@ -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
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment