From b91cf9b80f7099af94884c4b9590ca51fbb7a3bb Mon Sep 17 00:00:00 2001 From: xyj <1090822794@qq.com> Date: Tue, 27 Feb 2024 09:27:56 +0800 Subject: [PATCH] fixed --- sql/sql.py | 4 ++++ xumu.py | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/sql/sql.py b/sql/sql.py index c41c8ef..6cea145 100644 --- a/sql/sql.py +++ b/sql/sql.py @@ -167,6 +167,9 @@ def get_has_clientId_sql(clientid): return send_json + + + # 获取空气设备历史7天的报警数据sql def air_device_past_seven_days_sql(deviceId): current_date = datetime.now().date() @@ -178,6 +181,7 @@ def air_device_past_seven_days_sql(deviceId): } return send_json + # 获取普通设备历史7天的报警数据sql def common_device_past_seven_days_sql(deviceId): current_date = datetime.now().date() diff --git a/xumu.py b/xumu.py index fd2fc3d..8f76cca 100644 --- a/xumu.py +++ b/xumu.py @@ -161,12 +161,12 @@ async def register(request: Request): send_json = create_register_sql(iccid, deviceId, type) r = requests.post(baseHost + nonQueryUri, headers=headers, json=send_json) res.append(r.json()) + # 插入设备状态表,只有新注册的才会插入设备表 + send_json = insert_device_status_sql(iccid, clientid, deviceId) + r = requests.post(baseHost + nonQueryUri, headers=headers, json=send_json) + res.append(r.json()) else: return BaseResponse(code=500, msg="500 Internal error") - # 插入设备状态表 - send_json = insert_device_status_sql(iccid, clientid, deviceId) - r = requests.post(baseHost + nonQueryUri, headers=headers, json=send_json) - res.append(r.json()) # 创建相应的数据库和字段 sql_list = farm_sql(deviceId, type) for sql in sql_list: