fixed
This commit is contained in:
parent
b91cf9b80f
commit
cd68bdfb01
21
sql/sql.py
21
sql/sql.py
|
@ -167,9 +167,6 @@ def get_has_clientId_sql(clientid):
|
|||
return send_json
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# 获取空气设备历史7天的报警数据sql
|
||||
def air_device_past_seven_days_sql(deviceId):
|
||||
current_date = datetime.now().date()
|
||||
|
@ -318,16 +315,15 @@ def insert_to_warning_sql(deviceId, v, t):
|
|||
if t == 0:
|
||||
# RFID 温度
|
||||
temperature = v[1]
|
||||
prompt = f"动物体温为{temperature},正常吗?如果体温过高或过低,如何解决?"
|
||||
if temperature_threshold[1] <= temperature:
|
||||
v.append("体温过高")
|
||||
elif temperature <= temperature_threshold[0]:
|
||||
v.append("体温过低")
|
||||
v.append("不同生物的体温有差异,需根据生物体温的生理机制、体温调节方式及生存环境采取适当措施。")
|
||||
elif t == 1:
|
||||
# air 空气、湿度
|
||||
air_temperature = v[1]
|
||||
air_humidity = v[2]
|
||||
prompt = f"室外天气温度为{air_temperature},室外天气湿度{air_humidity},正常吗?如果过高或过低,如何解决?"
|
||||
if air_temperature_threshold[1] <= air_temperature:
|
||||
v.append("室外天气温度偏高")
|
||||
elif air_temperature <= air_temperature_threshold[0]:
|
||||
|
@ -336,28 +332,23 @@ def insert_to_warning_sql(deviceId, v, t):
|
|||
v.append("室外天气湿度偏高")
|
||||
elif air_humidity <= air_humidity_threshold[0]:
|
||||
v.append("室外天气湿度偏低")
|
||||
v.append("室内外温度偏高或偏低,需根据环境采取适当措施,如提供遮蔽和防晒、保持适宜的室内温度、增加保暖措施、提供饮水等。")
|
||||
elif t == 2:
|
||||
# danqi 氮气
|
||||
danqi = v[1]
|
||||
prompt = f"空气中氮气浓度为{danqi},正常吗?如果过高或过低,如何解决?"
|
||||
v.append("氮气浓度偏高")
|
||||
v.append("注意通风。")
|
||||
elif t == 3:
|
||||
# jiawan 甲烷
|
||||
jiawan = v[1]
|
||||
prompt = f"空气中甲烷浓度为{jiawan},正常吗?如果过高或过低,如何解决?"
|
||||
v.append("甲烷浓度过高")
|
||||
v.append("注意通风。")
|
||||
elif t == 4:
|
||||
# zaoyin 噪音
|
||||
zaoyin = v[1]
|
||||
prompt = f"噪音分贝为{zaoyin},正常吗?如果过高或过低,如何解决?"
|
||||
v.append("噪音强度过高")
|
||||
v.append("监控动物的行为变化,根据变化采取适当措施。")
|
||||
elif t == 5:
|
||||
# yanwu 烟雾
|
||||
yanwu = v[1]
|
||||
prompt = f"烟雾浓度为{yanwu},正常吗?如果过高或过低,如何解决?"
|
||||
v.append("烟雾浓度偏高")
|
||||
|
||||
v.append("无")
|
||||
v.append("注意通风,并监控动物的行为变化,根据变化采取适当措施。")
|
||||
return {
|
||||
"devices": ["root.warning." + deviceId],
|
||||
"timestamps": [int(time.time() * 1000)],
|
||||
|
|
3
xumu.py
3
xumu.py
|
@ -285,9 +285,6 @@ async def process_data(request: Request):
|
|||
@app.get("/api/xumu/warning/past_seven_days")
|
||||
async def past_seven_days(deviceId):
|
||||
try:
|
||||
current_date = datetime.now().date()
|
||||
tomorrow = current_date + timedelta(days=1)
|
||||
past_6_days_date = current_date - timedelta(days=6)
|
||||
the_decvice = await get_device(None, deviceId)
|
||||
device_type = None
|
||||
if the_decvice.code == 200:
|
||||
|
|
Loading…
Reference in New Issue