Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
岳巧源
/
jd_data_process
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
4f543957
authored
Nov 06, 2024
by
larosa
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add push to mq
parent
45aeadfb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
push_to_mq.py
push_to_mq.py
View file @
4f543957
...
...
@@ -70,5 +70,30 @@ def post_msg(conf: dict):
# {"goods_id":1170115972487102103,"spu_id":2170115972437912400,"platform":1,"shop_id":1}
def
post_jd_is_null
(
conf
:
dict
):
"""
将 lie_shop_picture中 pdf 为空的 推送到队列中
"""
db
=
pymysql
.
connect
(
host
=
conf
[
"mysql"
][
"host"
],
port
=
3306
,
user
=
conf
[
"mysql"
][
"user"
],
password
=
conf
[
"mysql"
][
"password"
],
database
=
conf
[
"mysql"
][
"database"
])
cursor
=
db
.
cursor
()
sql
=
"select spu_id from lie_shop_picture WHERE jd_pdf = '' and spu_id != 0 ORDER BY create_time desc"
cursor
.
execute
(
query
=
sql
)
db_result
=
cursor
.
fetchall
()
for
i
in
range
(
len
(
db_result
)):
spu_id
=
db_result
[
i
][
0
]
platform
=
1
shop_id
=
2
data
=
{
"spu_id"
:
spu_id
,
"goods_id"
:
0
,
"platform"
:
platform
,
"shop_id"
:
shop_id
}
msg_str
=
json
.
dumps
(
data
,
ensure_ascii
=
False
)
push_mq
(
msg_str
)
if
__name__
==
'__main__'
:
post_msg
(
config_prod
)
\ No newline at end of file
post_jd_is_null
(
config_prod
)
\ No newline at end of file
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