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
ef003a03
authored
Oct 21, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add insert vc class
parent
4b5626f4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
1 deletions
tmp.sql
vc.py
vc_class.json
tmp.sql
0 → 100644
View file @
ef003a03
delete
from
lie_shop_class
where
platform
=
1
;
delete
from
lie_shop_attr
where
platform
=
1
;
\ No newline at end of file
vc.py
View file @
ef003a03
# 请求vc店铺的所有接口
import
json
import
time
import
pymysql
from
common
import
request_to_jd_vc
config_dev
=
{
"mysql"
:
{
"host"
:
"192.168.1.238"
,
"port"
:
3306
,
"user"
:
"liexin_data_distribution"
,
"password"
:
"liexin_data_distribution#zsyM"
,
"database"
:
"liexin_data_distribution"
},
"redis"
:
{
"host"
:
"192.168.1.235"
,
"port"
:
6379
,
"password"
:
"icDb29mLy2s"
}
}
config_prod
=
{
"mysql"
:
{
"host"
:
"bigdata2.ichunt.db"
,
"port"
:
3306
,
"user"
:
"DsbuUx"
,
"password"
:
"sfj09JjsfpQx0"
,
"database"
:
"liexin_data_distribution"
},
"redis"
:
{
"host"
:
"172.18.137.38"
,
"port"
:
6379
,
"password"
:
"icDb29mLy2s"
}
}
def
get_vc_audit
(
applyId
:
str
):
"""根据应用id 查找审核状态(若审核成功可以获得京东sku_id)"""
method_name
=
"jingdong.vc.item.product.apply.get"
...
...
@@ -21,11 +56,48 @@ def get_vc_attr(class_id: int):
"""获取vc分类的属性"""
def
get_vc_ext_attr
(
class_id
:
int
):
"""获取京东的拓展属性"""
def
insert_vc_class
(
conf
:
dict
):
method_name
=
"jingdong.vc.item.categories.find"
token
=
"845ce8478b074103b9e78a769d5fa4831y2u"
app_key
=
"CA52430E90209F51D8F5D7B615DDE9AD"
app_secret
=
"c92691b2379c48de87e699c4c2f7fb32"
param
=
{}
ans
=
request_to_jd_vc
(
method_name
,
token
,
app_key
,
app_secret
,
param
)
results
=
ans
[
"jingdong_vc_item_categories_find_responce"
][
"jos_result_dto"
][
"result"
]
host
=
conf
[
"mysql"
][
"host"
]
port
=
conf
[
"mysql"
][
"port"
]
user
=
conf
[
"mysql"
][
"user"
]
password
=
conf
[
"mysql"
][
"password"
]
database
=
conf
[
"mysql"
][
"database"
]
db
=
pymysql
.
connect
(
host
=
host
,
port
=
port
,
user
=
user
,
password
=
password
,
database
=
database
)
cursor
=
db
.
cursor
()
for
i
in
range
(
len
(
results
)):
parent_id
=
results
[
i
][
"cid3"
]
class_id
=
results
[
i
][
"id"
]
class_name
=
results
[
i
][
"name"
]
depth
=
results
[
i
][
"depth"
]
status
=
1
platform
=
1
create_time
=
int
(
time
.
time
())
insert_sql
=
"insert into lie_shop_class (parent_id, class_id, class_name, depth, status, platform, create_time) values (
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s)"
cursor
.
execute
(
query
=
insert_sql
,
args
=
(
parent_id
,
class_id
,
class_name
,
depth
,
status
,
platform
,
create_time
,))
db
.
commit
()
print
(
insert_sql
%
(
parent_id
,
class_id
,
class_name
,
depth
,
status
,
platform
,
create_time
))
def
insert_vc_attr
():
pass
if
__name__
==
'__main__'
:
ans
=
get_vc_audit
(
"0da56b0274c1415ebb415ec2164b408f"
)
conf
=
config_dev
insert_vc_class
(
conf
)
vc_class.json
0 → 100644
View file @
ef003a03
This diff is collapsed.
Click to expand it.
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