Commit 98d9550f by 岳巧源

add test

parent c73d42b1
Showing with 27 additions and 19 deletions
...@@ -3,6 +3,9 @@ import json ...@@ -3,6 +3,9 @@ import json
from common import request_to_jd_vc from common import request_to_jd_vc
def format_to_four_decimals(val):
return f"{val:.4f}"
def post_to_jd(): def post_to_jd():
methodName = "jingdong.vc.item.newProduct.createV2" methodName = "jingdong.vc.item.newProduct.createV2"
token = "845ce8478b074103b9e78a769d5fa4831y2u" token = "845ce8478b074103b9e78a769d5fa4831y2u"
...@@ -25,7 +28,7 @@ def post_to_jd(): ...@@ -25,7 +28,7 @@ def post_to_jd():
"item_num": "27348342899", "item_num": "27348342899",
"member_price": 1000.99, "member_price": 1000.99,
"market_price": 1100.99, "market_price": 1100.99,
"purchase_price": 900.0001, "purchase_price": 900.0000,
"saler_code": "gonglingzhe1", "saler_code": "gonglingzhe1",
"purchaser_code": "gonglingzhe1", "purchaser_code": "gonglingzhe1",
"prop_id": "232935,232969,232953,232988,274281,270354", # 属性id "prop_id": "232935,232969,232953,232988,274281,270354", # 属性id
...@@ -40,9 +43,13 @@ def post_to_jd(): ...@@ -40,9 +43,13 @@ def post_to_jd():
"intro_html": "<img src=https://img30.360buyimg.com/sku/jfs/t1/133800/28/25551/94742/62fef403E1a77f3a2/9b92597c0c26d1c8.jpg' /><br>", # pc商详 "intro_html": "<img src=https://img30.360buyimg.com/sku/jfs/t1/133800/28/25551/94742/62fef403E1a77f3a2/9b92597c0c26d1c8.jpg' /><br>", # pc商详
"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=methodName, token=token, app_key=app_key, app_secret=app_secret, param=param) # ans = request_to_jd_vc(method_name=methodName, token=token, app_key=app_key, app_secret=app_secret, param=param)
print(json.dumps(ans, ensure_ascii=False)) # print(json.dumps(ans, ensure_ascii=False))
ans_s = json.dumps(param, ensure_ascii=False)
print(ans_s)
if __name__ == '__main__': if __name__ == '__main__':
post_to_jd() ans = format_to_four_decimals(9.678)
print(ans)
sql = "select select goods_id, spu_id, supplier_id from "
\ No newline at end of file
...@@ -18,19 +18,19 @@ config_prod = { ...@@ -18,19 +18,19 @@ config_prod = {
conf = config_prod conf = config_prod
# if __name__ == '__main__': if __name__ == '__main__':
# host = conf["redis"]["host"] host = conf["redis"]["host"]
# port = conf["redis"]["port"] port = conf["redis"]["port"]
# password = conf["redis"]["password"] password = conf["redis"]["password"]
# db = redis.Redis(host=host, port=port, password=password, decode_responses=True) db = redis.Redis(host=host, port=port, password=password, decode_responses=True)
# # ans = db.hget("jd_ext_attr", "33836") # ans = db.hget("jd_ext_attr", "33836")
# ans = db.hgetall("jd_ext_attr") ans = db.hget("spu", "2172358037068768407")
# print(ans) print(ans)
if __name__ == '__main__': # if __name__ == '__main__':
query_sql = "update lie_shop_attr set is_required = 0 where id = 5096 or id = 5097 or id = 493" # query_sql = "update lie_shop_attr set is_required = 0 where id = 5096 or id = 5097 or id = 493"
db = pymysql.connect(host=conf["mysql"]["host"], port=3306, user=conf["mysql"]["user"], password=conf["mysql"]["password"], database=conf["mysql"]["database"]) # db = pymysql.connect(host=conf["mysql"]["host"], port=3306, user=conf["mysql"]["user"], password=conf["mysql"]["password"], database=conf["mysql"]["database"])
cursor = db.cursor() # cursor = db.cursor()
cursor.execute(query=query_sql) # cursor.execute(query=query_sql)
db.commit() # db.commit()
\ No newline at end of file \ 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