Commit ba4026dc authored by liguangyu06's avatar liguangyu06
Browse files

优化

parent ec0ac742
...@@ -13,7 +13,6 @@ import requests ...@@ -13,7 +13,6 @@ import requests
import random import random
import json import json
module = "cmdc_product" module = "cmdc_product"
# 第一步登录 # 第一步登录
...@@ -54,18 +53,19 @@ result = requests.post(url, json=request_body, headers=headers) ...@@ -54,18 +53,19 @@ result = requests.post(url, json=request_body, headers=headers)
# 获取接口响应时间 # 获取接口响应时间
api_time = float(result.elapsed.total_seconds()) api_time = float(result.elapsed.total_seconds())
result = json.loads(result.content) result = json.loads(result.content)
# print(result)
# 获取制单员数量 # 获取制单员数量
result = {"total": result["data"]["total"]} result = {"total": result["data"]["total"]}
result["api_time"] = api_time result["api_time"] = api_time
# print(result)
# 数据库操作 # 数据库操作
mysql_handle = mySql() mysql_handle = mySql()
# 获取conf.ini文件中配置的数据库信息 # 获取conf.ini文件中配置的数据库信息
host, port, user, pwd = mysql_handle.getConf(db="cmdc_db") host, port, user, pwd = mysql_handle.getConf(db="cmdc_db")
# 查询数据库中产品线对应制单员数量 # 查询数据库中产品线对应制单员数量
sql = "SELECT count(t.id) FROM `cmdc-product`.ic_marker_member t WHERE userId = 2795 and productLineCode = {}".format(product_line_code) sql = "SELECT count(t.id) FROM `cmdc-product`.ic_marker_member t " \
"WHERE userId = 2795 and productLineCode = '{}'".format(product_line_code)
total = mysql_handle.selectSql(host, port, user, pwd, "cmdc-product", sql)[0][0] total = mysql_handle.selectSql(host, port, user, pwd, "cmdc-product", sql)[0][0]
# 获取预期结果 # 获取预期结果
......
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