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
73c676cd
authored
Sep 30, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add push sku
parent
ef63d255
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
push_sku_to_nplm.py
push_sku_to_nplm.py
View file @
73c676cd
...
...
@@ -9,7 +9,7 @@ import pymysql
import
redis
db
=
redis
.
Redis
(
host
=
'192.168.1.235'
,
port
=
6379
,
password
=
'icDb29mLy2s'
,
decode_responses
=
True
)
db_234
=
redis
.
Redis
(
host
=
'192.168.1.234'
,
port
=
6379
,
password
=
'icDb29mLy1s'
,
decode_responses
=
True
)
def
get_channel_info
():
"""return supplier_id 或者 brand_id 等等"""
...
...
@@ -32,7 +32,6 @@ 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
,))
...
...
@@ -42,11 +41,14 @@ def period_get_data(db_name, table_name, condition) -> list:
data
.
append
(
results
[
i
][
0
])
return
data
def
int_to_str
(
a
)
->
str
:
return
str
(
a
)
def
get_class_from_rds
(
spu_id
):
"""根据spu_id 在redis中获取到对应的品牌和分类"""
infos
=
db_234
.
hget
(
"spu"
,
str
(
spu_id
))
return
json
.
loads
(
infos
)
if
__name__
==
'__main__'
:
condition
=
get_channel_info
()
ans
=
period_get_data
(
"liexin_sku_0"
,
"lie_sku_0"
,
condition
)
print
(
ans
)
\ No newline at end of file
spu_ids
=
period_get_data
(
"liexin_sku_0"
,
"lie_sku_0"
,
condition
)
infos
=
get_class_from_rds
(
spu_ids
[
0
])
print
(
type
(
infos
))
\ 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