Commit 70a41c7e authored by liguangyu06's avatar liguangyu06
Browse files

优化

parent e643b7ba
Showing with 7 additions and 2 deletions
+7 -2
......@@ -28,7 +28,7 @@ request_body = commonFuc().get_business_data(module, "payload33")
# 发送请求
result = requests.post(url, json=request_body, headers=headers)
result = json.loads(result.content)
# print(result)
# 生成随机数
customer_random = random.randint(0, len(result["data"]["list"]) - 1)
# 获取客户信息
......@@ -52,8 +52,10 @@ api_time = float(result.elapsed.total_seconds())
# 获取用户默认地址信息
result = json.loads(result.content)
# print(result)
# 判断有些用户没有默认地址
if result["data"]:
is_default = result["data"][0]["isDefault"]
result = {"addressId": result["data"][0]["addressId"]}
# 将接口响应时间添加至结果中
result["api_time"] = api_time
......@@ -65,8 +67,11 @@ if result["data"]:
# 查询数据库中对应的用户的默认地址
sql = "SELECT t.addressId FROM `cmdc-user`.cmdc_user_address t " \
"WHERE userId = {} and companyId = {} and deleteSign = 0 and isDefault = 1".format(user_id, company_id)
"WHERE userId = {} and companyId = {} and deleteSign = 0 " \
"and isDefault = {}".format(user_id, company_id, is_default)
# print(sql)
address_id = mysql_handle.selectSql(host, port, user, pwd, "cmdc-user", sql)[0][0]
# print(address_id)
# 获取预期结果
check_dict = commonFuc().get_business_data(module, "checkDict35", address_id)
......
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