|
@@ -58,9 +58,6 @@ class DetectControllerViewV2(View):
|
|
|
# 更新推送延迟
|
|
|
elif operation == 'updateInterval':
|
|
|
return self.do_update_interval(userID, request_dict, response)
|
|
|
- # 修改推送报警开关、手动报警开关
|
|
|
- elif operation == 'updateAlarmpushOrManualalarm':
|
|
|
- return self.do_update_alarmpush_or_manualalarm(userID, request_dict, response)
|
|
|
else:
|
|
|
return response.json(414)
|
|
|
else:
|
|
@@ -444,27 +441,6 @@ class DetectControllerViewV2(View):
|
|
|
else:
|
|
|
return response.json(0)
|
|
|
|
|
|
- def do_update_alarmpush_or_manualalarm(self, user_id, request_dict, response):
|
|
|
- uid = request_dict.get('uid', None)
|
|
|
- status = request_dict.get('status', None)
|
|
|
- alarm_type = request_dict.get('alarm_type', None)
|
|
|
- if not all([uid, status, alarm_type]):
|
|
|
- return response.json(444, 'uid or status or alarm_type')
|
|
|
- # 查询设备是否属于该用户
|
|
|
- device_info_qs = Device_Info.objects.filter(userID_id=user_id, UID=uid)
|
|
|
- if not device_info_qs.exists():
|
|
|
- return response.json(14)
|
|
|
- thing_name = CommonService.query_serial_with_uid(uid) # 存在序列号则为使用序列号作为物品名
|
|
|
- topic_name = 'ansjer/generic/{}'.format(thing_name)
|
|
|
- msg = {
|
|
|
- 'commandType': alarm_type,
|
|
|
- 'enable': status
|
|
|
- }
|
|
|
- req_success = CommonService.req_publish_mqtt_msg(thing_name, topic_name, msg)
|
|
|
- if not req_success:
|
|
|
- return response.json(10044)
|
|
|
- return response.json(0)
|
|
|
-
|
|
|
|
|
|
# 这个接口没有调用过,不敢动
|
|
|
# http://test.dvema.com/detect/add?uidToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiJQMldOR0pSRDJFSEE1RVU5MTExQSJ9.xOCI5lerk8JOs5OcAzunrKCfCrtuPIZ3AnkMmnd-bPY&n_time=1526845794&channel=1&event_type=51&is_st=0
|