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
03c4180c
authored
Oct 28, 2024
by
岳巧源
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
add vc
parent
17cc4273
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
15 deletions
vc.py
vc.py
View file @
03c4180c
...
@@ -7,7 +7,6 @@ import redis
...
@@ -7,7 +7,6 @@ import redis
from
common
import
request_to_jd_vc
from
common
import
request_to_jd_vc
config_dev
=
{
config_dev
=
{
"mysql"
:
{
"mysql"
:
{
"host"
:
"192.168.1.238"
,
"host"
:
"192.168.1.238"
,
...
@@ -147,11 +146,11 @@ def insert_vc_attr(conf: dict):
...
@@ -147,11 +146,11 @@ def insert_vc_attr(conf: dict):
elif
input_type
==
3
:
elif
input_type
==
3
:
# 文本类型
# 文本类型
# 文本类型没有可选值
# 文本类型没有可选值
pass
pass
elif
input_type
==
7
:
elif
input_type
==
7
:
# 数值类型
# 数值类型
# 数值类型没有可选值
# 数值类型没有可选值
pass
pass
elif
input_type
==
10
:
elif
input_type
==
10
:
# 多单位多解析的方式
# 多单位多解析的方式
# 多单位多解析 需要特殊处理单位字段
# 多单位多解析 需要特殊处理单位字段
...
@@ -167,10 +166,12 @@ def insert_vc_attr(conf: dict):
...
@@ -167,10 +166,12 @@ def insert_vc_attr(conf: dict):
print
(
"此input_type类型暂未兼容处理!请单独处理!"
)
print
(
"此input_type类型暂未兼容处理!请单独处理!"
)
create_time
=
int
(
time
.
time
())
create_time
=
int
(
time
.
time
())
insert_sql
=
"insert into lie_shop_attr (class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time) values (
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s)"
insert_sql
=
"insert into lie_shop_attr (class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time) values (
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s)"
cursor
.
execute
(
query
=
insert_sql
,
args
=
(
class_id
,
attr_id
,
attr_name
,
unit
,
enum_value
,
input_type
,
is_required
,
status
,
platform
,
create_time
,))
cursor
.
execute
(
query
=
insert_sql
,
args
=
(
class_id
,
attr_id
,
attr_name
,
unit
,
enum_value
,
input_type
,
is_required
,
status
,
platform
,
create_time
,))
db
.
commit
()
db
.
commit
()
print
(
insert_sql
%
(
class_id
,
attr_id
,
attr_name
,
unit
,
enum_value
,
input_type
,
is_required
,
status
,
platform
,
create_time
))
print
(
insert_sql
%
(
class_id
,
attr_id
,
attr_name
,
unit
,
enum_value
,
input_type
,
is_required
,
status
,
platform
,
create_time
))
def
insert_vc_ext_attr
(
conf
:
dict
):
def
insert_vc_ext_attr
(
conf
:
dict
):
...
@@ -234,9 +235,12 @@ def insert_vc_ext_attr(conf: dict):
...
@@ -234,9 +235,12 @@ def insert_vc_ext_attr(conf: dict):
else
:
else
:
print
(
"暂时未兼容此种类型的拓展属性 input_type: "
+
str
(
input_type
))
print
(
"暂时未兼容此种类型的拓展属性 input_type: "
+
str
(
input_type
))
insert_sql
=
"insert into lie_shop_attr (class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time) values (
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s)"
insert_sql
=
"insert into lie_shop_attr (class_id, attr_id, attr_name, unit, enum_value, input_type, is_required, status, platform, create_time) values (
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s,
%
s)"
cursor
.
execute
(
query
=
insert_sql
,
args
=
(
class_id
,
attr_id
,
attr_name
,
unit
,
enum_value
,
input_type
,
is_required
,
status
,
platform
,
create_time
,))
cursor
.
execute
(
query
=
insert_sql
,
args
=
(
class_id
,
attr_id
,
attr_name
,
unit
,
enum_value
,
input_type
,
is_required
,
status
,
platform
,
create_time
,))
db
.
commit
()
db
.
commit
()
print
(
insert_sql
%
(
class_id
,
attr_id
,
attr_name
,
unit
,
enum_value
,
input_type
,
is_required
,
status
,
platform
,
create_time
))
print
(
insert_sql
%
(
class_id
,
attr_id
,
attr_name
,
unit
,
enum_value
,
input_type
,
is_required
,
status
,
platform
,
create_time
))
def
insert_ext_attr_to_redis
(
conf
:
dict
):
def
insert_ext_attr_to_redis
(
conf
:
dict
):
host
=
conf
[
"mysql"
][
"host"
]
host
=
conf
[
"mysql"
][
"host"
]
...
@@ -260,7 +264,8 @@ def insert_ext_attr_to_redis(conf: dict):
...
@@ -260,7 +264,8 @@ def insert_ext_attr_to_redis(conf: dict):
param
=
{
param
=
{
"category_leaf_id"
:
class_id
,
"category_leaf_id"
:
class_id
,
}
}
ans
=
request_to_jd_vc
(
method_name
=
method_name
,
token
=
token
,
app_key
=
app_key
,
app_secret
=
app_secret
,
param
=
param
)
ans
=
request_to_jd_vc
(
method_name
=
method_name
,
token
=
token
,
app_key
=
app_key
,
app_secret
=
app_secret
,
param
=
param
)
print
(
"request to jd ...."
)
print
(
"request to jd ...."
)
if
"result"
not
in
ans
[
"jingdong_vc_item_extProps_find_responce"
][
"jos_result_dto"
]:
if
"result"
not
in
ans
[
"jingdong_vc_item_extProps_find_responce"
][
"jos_result_dto"
]:
continue
continue
...
@@ -301,7 +306,7 @@ def update_vc_goods_attr():
...
@@ -301,7 +306,7 @@ def update_vc_goods_attr():
app_key
=
"CA52430E90209F51D8F5D7B615DDE9AD"
app_key
=
"CA52430E90209F51D8F5D7B615DDE9AD"
app_secret
=
"c92691b2379c48de87e699c4c2f7fb32"
app_secret
=
"c92691b2379c48de87e699c4c2f7fb32"
param
=
{
param
=
{
"ware_id"
:
"100124079781"
,
"ware_id"
:
"100124079781"
,
"en_brand"
:
"Kingbright"
,
"en_brand"
:
"Kingbright"
,
"zh_brand"
:
"Kingbright"
,
"zh_brand"
:
"Kingbright"
,
"pkg_info"
:
"商品主体 * 1"
,
"pkg_info"
:
"商品主体 * 1"
,
...
@@ -318,10 +323,10 @@ def update_vc_goods_attr():
...
@@ -318,10 +323,10 @@ def update_vc_goods_attr():
"prop_vid"
:
",,,,1639267"
,
"prop_vid"
:
",,,,1639267"
,
"ext_id"
:
"235849"
,
"ext_id"
:
"235849"
,
"ext_values"
:
"1336374"
,
"ext_values"
:
"1336374"
,
"main_path"
:
"jfs/t1/232493/18/26763/19756/670d354fFa5efdaae/c3fe357ecb152ae7.jpg"
,
"main_path"
:
"jfs/t1/232493/18/26763/19756/670d354fFa5efdaae/c3fe357ecb152ae7.jpg"
,
"main_isPrimary"
:
"1"
,
"main_isPrimary"
:
"1"
,
"intro_html"
:
"<img src=https://img30.360buyimg.com/sku/jfs/t1/133800/28/25551/94742/62fef403E1a77f3a2/9b92597c0c26d1c8.jpg' /><br>"
,
"intro_html"
:
"<img src=https://img30.360buyimg.com/sku/jfs/t1/133800/28/25551/94742/62fef403E1a77f3a2/9b92597c0c26d1c8.jpg' /><br>"
,
"intro_mobile"
:
"<img src=https://img30.360buyimg.com/sku/jfs/t1/133800/28/25551/94742/62fef403E1a77f3a2/9b92597c0c26d1c8.jpg' /><br>"
,
"intro_mobile"
:
"<img src=https://img30.360buyimg.com/sku/jfs/t1/133800/28/25551/94742/62fef403E1a77f3a2/9b92597c0c26d1c8.jpg' /><br>"
,
}
}
ans
=
request_to_jd_vc
(
method_name
,
token
,
app_key
,
app_secret
,
param
)
ans
=
request_to_jd_vc
(
method_name
,
token
,
app_key
,
app_secret
,
param
)
print
(
json
.
dumps
(
ans
,
ensure_ascii
=
False
))
print
(
json
.
dumps
(
ans
,
ensure_ascii
=
False
))
...
@@ -348,6 +353,7 @@ def set_vc_init_stock_and_delivery(stock_num, delivery_day, ware_id):
...
@@ -348,6 +353,7 @@ def set_vc_init_stock_and_delivery(stock_num, delivery_day, ware_id):
ans
=
request_to_jd_vc
(
method_name
,
token
,
app_key
,
app_secret
,
param
)
ans
=
request_to_jd_vc
(
method_name
,
token
,
app_key
,
app_secret
,
param
)
print
(
json
.
dumps
(
ans
,
ensure_ascii
=
False
))
print
(
json
.
dumps
(
ans
,
ensure_ascii
=
False
))
def
modify_vc_stock_num
(
stock_num
,
ware_id
):
def
modify_vc_stock_num
(
stock_num
,
ware_id
):
"""
"""
修改vc商品库存
修改vc商品库存
...
@@ -376,6 +382,56 @@ def get_vc_goods_info(ware_id: str):
...
@@ -376,6 +382,56 @@ def get_vc_goods_info(ware_id: str):
print
(
json
.
dumps
(
ans
,
ensure_ascii
=
False
))
print
(
json
.
dumps
(
ans
,
ensure_ascii
=
False
))
def
modify_jd_vc_market_price
():
"""
修改vc市场价,京东价
"""
method_name
=
"jingdong.promotion.adjust.price.updatePrice"
token
=
"845ce8478b074103b9e78a769d5fa4831y2u"
app_key
=
"CA52430E90209F51D8F5D7B615DDE9AD"
app_secret
=
"c92691b2379c48de87e699c4c2f7fb32"
param
=
{
"appReason"
:
"调整价格测试"
,
"skuPriceInfo"
:
{
"@type"
:
"com.jd.promotion.external.sdk.request.SkuPriceInfo"
,
"site"
:
301
,
# "marketPrice": "",
"salePrice"
:
131.18
,
"skuId"
:
100124748677
,
},
"venderInfo"
:
{
"@type"
:
"com.jd.promotion.external.sdk.request.VenderInfo"
,
"supplierCode"
:
"10457263"
,
"applicant"
:
"yqy"
,
"appReason"
:
"调整价格测试"
,
},
}
ans
=
request_to_jd_vc
(
method_name
,
token
,
app_key
,
app_secret
,
param
)
print
(
json
.
dumps
(
ans
,
ensure_ascii
=
False
))
def
modify_vc_purchase_price
():
method_name
=
""
token
=
"845ce8478b074103b9e78a769d5fa4831y2u"
app_key
=
"CA52430E90209F51D8F5D7B615DDE9AD"
app_secret
=
"c92691b2379c48de87e699c4c2f7fb32"
param
=
{
"basePriceChanges"
:
[
{
"@type"
:
"com.jd.pps.pub.dto.PpsBasePriceChangeDto"
,
"lineKey"
:
1
,
"changeReason"
:
"修改采购价格内部测试"
,
"discount"
:
"13"
,
"orgId"
:
-
1
,
"vendorCode"
:
"ichunt"
,
"price"
:
100.00
,
"currency"
:
"RMB"
,
"sku"
:
100124748677
,
}
]
}
ans
=
request_to_jd_vc
(
method_name
,
token
,
app_key
,
app_secret
,
param
)
print
(
json
.
dumps
(
ans
,
ensure_ascii
=
False
))
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
get_vc_audit
(
"6db37def5bcd467ca063863e04ea4d4b"
)
modify_jd_vc_market_price
()
\ 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