This commit is contained in:
xyj 2024-02-27 09:27:56 +08:00
parent 4e7500b8db
commit b91cf9b80f
2 changed files with 8 additions and 4 deletions

View File

@ -167,6 +167,9 @@ def get_has_clientId_sql(clientid):
return send_json return send_json
# 获取空气设备历史7天的报警数据sql # 获取空气设备历史7天的报警数据sql
def air_device_past_seven_days_sql(deviceId): def air_device_past_seven_days_sql(deviceId):
current_date = datetime.now().date() current_date = datetime.now().date()
@ -178,6 +181,7 @@ def air_device_past_seven_days_sql(deviceId):
} }
return send_json return send_json
# 获取普通设备历史7天的报警数据sql # 获取普通设备历史7天的报警数据sql
def common_device_past_seven_days_sql(deviceId): def common_device_past_seven_days_sql(deviceId):
current_date = datetime.now().date() current_date = datetime.now().date()

View File

@ -161,12 +161,12 @@ async def register(request: Request):
send_json = create_register_sql(iccid, deviceId, type) send_json = create_register_sql(iccid, deviceId, type)
r = requests.post(baseHost + nonQueryUri, headers=headers, json=send_json) r = requests.post(baseHost + nonQueryUri, headers=headers, json=send_json)
res.append(r.json()) res.append(r.json())
else: # 插入设备状态表,只有新注册的才会插入设备表
return BaseResponse(code=500, msg="500 Internal error")
# 插入设备状态表
send_json = insert_device_status_sql(iccid, clientid, deviceId) send_json = insert_device_status_sql(iccid, clientid, deviceId)
r = requests.post(baseHost + nonQueryUri, headers=headers, json=send_json) r = requests.post(baseHost + nonQueryUri, headers=headers, json=send_json)
res.append(r.json()) res.append(r.json())
else:
return BaseResponse(code=500, msg="500 Internal error")
# 创建相应的数据库和字段 # 创建相应的数据库和字段
sql_list = farm_sql(deviceId, type) sql_list = farm_sql(deviceId, type)
for sql in sql_list: for sql in sql_list: