Commit 1602e4f3 authored by lcn's avatar lcn

bug修复

parent c93338fe
...@@ -82,6 +82,11 @@ async def data_operation_search_service(mtid, point, params, start, end, ...@@ -82,6 +82,11 @@ async def data_operation_search_service(mtid, point, params, start, end,
if not point and mtid: if not point and mtid:
data = await get_pid_by_mtid(mtid) data = await get_pid_by_mtid(mtid)
point = data["pid"] point = data["pid"]
if point and not mtid:
mt_data = await get_mtid_by_pid(point)
mtid = mt_data["mtid"]
else:
mt_data = None
# 是否有温度和漏电流 # 是否有温度和漏电流
all_datas, temp = {}, {} all_datas, temp = {}, {}
if "temperature" in params: if "temperature" in params:
...@@ -90,6 +95,7 @@ async def data_operation_search_service(mtid, point, params, start, end, ...@@ -90,6 +95,7 @@ async def data_operation_search_service(mtid, point, params, start, end,
Ctemp=temperature["Ctemp"], Ntemp=temperature["Ntemp"]) Ctemp=temperature["Ctemp"], Ntemp=temperature["Ntemp"])
resi = {} resi = {}
if "residual_current" in params: if "residual_current" in params:
if not mt_data:
mt_data = await get_mtid_by_pid(point) mt_data = await get_mtid_by_pid(point)
resi_data = await get_locationid_by_mtid(mt_data["mtid"], resi_data = await get_locationid_by_mtid(mt_data["mtid"],
"residual_current") "residual_current")
...@@ -124,7 +130,7 @@ async def data_operation_search_service(mtid, point, params, start, end, ...@@ -124,7 +130,7 @@ async def data_operation_search_service(mtid, point, params, start, end,
for slot in slots: for slot in slots:
if slot in new_data.keys(): if slot in new_data.keys():
for i in all_datas.keys(): for i in all_datas.keys():
all_datas[i].append(new_data[slot].get(i, "")) all_datas[i].append(new_data[slot].get(i) or "")
else: else:
for i in all_datas.keys(): for i in all_datas.keys():
all_datas[i].append('') all_datas[i].append('')
......
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 to comment