Commit b1f10928 authored by liguangyu06's avatar liguangyu06
Browse files

优化

parent 40dad858
......@@ -30,15 +30,26 @@ result = json.loads(result.content)
# print(result)
# 生成随机数
product_random = random.randint(0, len(result["data"]["list"]) - 1)
# 此函数用于当x为none时,进行空字符串替换
def func(x):
if x is None:
x = ""
return x
else:
return x
# 获取商品限购信息
product_name = result["data"]["list"][product_random]["productName"]
product_name = func(result["data"]["list"][product_random]["productName"])
product_code = result["data"]["list"][product_random]["productCode"]
customer_code = result["data"]["list"][product_random]["customerCode"]
customer_name = result["data"]["list"][product_random]["customerName"]
specifications = result["data"]["list"][product_random]["specifications"]
product_line_name = result["data"]["list"][product_random]["cpdl01"]
manufacturer = result["data"]["list"][product_random]["manufacturer"]
material_code = result["data"]["list"][product_random]["materialCode"]
customer_code = func(result["data"]["list"][product_random]["customerCode"])
customer_name = func(result["data"]["list"][product_random]["customerName"])
specifications = func(result["data"]["list"][product_random]["specifications"])
product_line_name = func(result["data"]["list"][product_random]["cpdl01"])
manufacturer = func(result["data"]["list"][product_random]["manufacturer"])
material_code = func(result["data"]["list"][product_random]["materialCode"])
start_time = result["data"]["list"][product_random]["takeEffectTime"] + " 00:00:00"
# 进行查询条件验证操作
......@@ -46,7 +57,7 @@ url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url42")
request_body = commonFuc().get_business_data(module, "payload42", product_name, product_code,
customer_code, customer_name, specifications, product_line_name,
manufacturer, material_code, start_time)
# print(request_body)
"""
场景: 查询条件验证_商品限购列表
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment