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
ef63d255
authored
Sep 30, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add py
parent
011daeb1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletions
push_sku_to_nplm.py
push_sku_to_nplm.py
View file @
ef63d255
...
...
@@ -5,6 +5,7 @@
# 映射组装后推送到 go_nplm_server处理
import
json
import
pymysql
import
redis
db
=
redis
.
Redis
(
host
=
'192.168.1.235'
,
port
=
6379
,
password
=
'icDb29mLy2s'
,
decode_responses
=
True
)
...
...
@@ -27,8 +28,25 @@ def get_channel_info():
data
[
"platform"
]
=
platform
return
data
def
period_get_data
(
db_name
,
table_name
,
condition
)
->
list
:
"""指定数据库 指定表中获取数据"""
db
=
pymysql
.
connect
(
host
=
'192.168.1.238'
,
port
=
3306
,
user
=
'spu'
,
password
=
'spu'
,
database
=
db_name
)
supplier_ids
=
condition
[
"supplier_id_list"
]
placeholders
=
", "
.
join
([
"
%
s"
]
*
len
(
supplier_ids
))
sql
=
"select spu_id from "
+
table_name
+
" where supplier_id in
%
s"
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
,
args
=
(
supplier_ids
,))
results
=
cursor
.
fetchall
()
data
=
[]
for
i
in
range
(
len
(
results
)):
data
.
append
(
results
[
i
][
0
])
return
data
def
int_to_str
(
a
)
->
str
:
return
str
(
a
)
if
__name__
==
'__main__'
:
get_channel_info
()
condition
=
get_channel_info
()
ans
=
period_get_data
(
"liexin_sku_0"
,
"lie_sku_0"
,
condition
)
print
(
ans
)
\ 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