statistics

This commit is contained in:
xyj 2024-02-20 15:01:35 +08:00
parent fa26dd2418
commit 9621df8711
1 changed files with 9 additions and 6 deletions

View File

@ -1,5 +1,6 @@
# 数据库插入类型 # 数据库插入类型
import base64 import base64
import copy
import time import time
rfid_type = ["TEXT", "TEXT", "FLOAT", "INT32"] rfid_type = ["TEXT", "TEXT", "FLOAT", "INT32"]
@ -134,17 +135,19 @@ def is_warning(deviceId, v, t):
def insert_to_warning_sql(deviceId, v, t): def insert_to_warning_sql(deviceId, v, t):
measurements[t].append("reason") ml = copy.deepcopy(measurements[t])
measurements[t].append("solve") dt = copy.deepcopy(dataTypes[t])
dataTypes[t].append("TEXT") ml.append("reason")
dataTypes[t].append("TEXT") ml.append("solve")
dt.append("TEXT")
dt.append("TEXT")
v.append("") v.append("")
v.append("") v.append("")
return { return {
"devices": ["root.warning." + deviceId], "devices": ["root.warning." + deviceId],
"timestamps": [int(time.time() * 1000)], "timestamps": [int(time.time() * 1000)],
"measurements_list": [measurements[t]], "measurements_list": [ml],
"data_types_list": [dataTypes[t]], "data_types_list": [dt],
"values_list": [v], "values_list": [v],
"is_aligned": False "is_aligned": False
} }