Commit 03c4180c by 岳巧源

add vc

parent 17cc4273
Showing with 67 additions and 12 deletions
...@@ -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",
...@@ -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
...@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment