|
|
@@ -57,12 +57,13 @@ class CountDeviceStatus(APIView):
|
|
|
offline += 1
|
|
|
new.append(k)
|
|
|
myclient.close()
|
|
|
- return Response({"count": offline + online, "online": online, "offline": offline, "device": new})
|
|
|
+ return Response({"count": offline + online, "online": online, "offline": offline, "device": new, "mtg_name": True})
|
|
|
|
|
|
|
|
|
class QxData(APIView):
|
|
|
# 气象、墒情监测数据
|
|
|
def post(self, request):
|
|
|
+ print(1/0)
|
|
|
result = {}
|
|
|
device_id = {
|
|
|
"气象站": "864865060482180",
|
|
|
@@ -107,7 +108,8 @@ class QxData(APIView):
|
|
|
return Response({
|
|
|
"qxz":tmp,
|
|
|
"qxz_conf": conf,
|
|
|
- "sqz": data
|
|
|
+ "sqz": data,
|
|
|
+ "mtg_name": True
|
|
|
})
|
|
|
|
|
|
|
|
|
@@ -118,12 +120,10 @@ class QxWarning(APIView):
|
|
|
db = myclient.smartfarming
|
|
|
qxz_alarm = db.sa_qxz_alarm_log_new
|
|
|
k = qxz_alarm.find_one(sort=[("id", -1)])["id"] + 1
|
|
|
- print(k)
|
|
|
-
|
|
|
query = {'device_id': "864865060482180"}
|
|
|
data = qxz_alarm.find(query, {"_id":0, "warning_content": 1, "upl_time": 1}).sort("upl_time", pymongo.DESCENDING).limit(5)
|
|
|
myclient.close()
|
|
|
- return Response(list(data))
|
|
|
+ return Response({"warning": list(data), "mtg_name": True})
|
|
|
|
|
|
|
|
|
class CameraDetail(APIView):
|
|
|
@@ -154,8 +154,9 @@ class CameraDetail(APIView):
|
|
|
"device_id": device_id,
|
|
|
"device_name": device_name if device_name else device_id,
|
|
|
"device_info": addr,
|
|
|
- "is_name": device_name
|
|
|
+ "is_name": device_name,
|
|
|
+
|
|
|
})
|
|
|
myclient.close()
|
|
|
- return Response(result)
|
|
|
+ return Response({"camera": result, "mtg_name": True})
|
|
|
|