Commit 1ac874b8 authored by liguangyu06's avatar liguangyu06
Browse files

优化

1 merge request!6Master|代码更新归档
Showing with 9 additions and 9 deletions
+9 -9
......@@ -28,21 +28,21 @@ request_body = commonFuc().get_business_data(module, "payload83")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
print(result)
# 生成随机数
pr_random = random.randint(0, len(result["data"]) - 1)
pr_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取商品信息
startTime = result["data"][pr_random]["createTime"][:10] + " 00:00:00"
startTime = result["data"]["list"][pr_random]["createTime"][:10] + " 00:00:00"
now_time = str(datetime.datetime.now().strftime("%Y-%m-%d")) + " 00:00:00"
productInfo = result["data"][pr_random]["productCode"]
customerInfo = result["data"][pr_random]["customerCode"]
procurementDate = result["data"][pr_random]["procurementDate"]
productInfo = result["data"]["list"][pr_random]["productCode"]
customerInfo = result["data"]["list"][pr_random]["customerCode"]
procurementDate = result["data"]["list"][pr_random]["procurementDate"]
# 第三步进行列表查询条件验证
url = commonFuc().get_api_url() + commonFuc().get_business_data(module, "url84")
request_body = commonFuc().get_business_data(module, "payload84", startTime, now_time, productInfo, customerInfo,
startTime, now_time, procurementDate)
# print(request_body)
"""
场景: 列表查询条件验证_商品预测明细
......@@ -54,10 +54,10 @@ request_body = commonFuc().get_business_data(module, "payload84", startTime, now
result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间
api_time = float(result.elapsed.total_seconds())
# print(result)
# 获取查询结果中商品信息
result = json.loads(result.content)
result = {"productInfo": result["data"][0]["productCode"]}
result = {"productInfo": result["data"]["list"][0]["productCode"]}
# 将接口响应时间添加至result
result["api_time"] = api_time
......
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