Browse Source

删除查询开关信息代码

peng 1 year ago
parent
commit
f07aae35e5
1 changed files with 1 additions and 29 deletions
  1. 1 29
      Controller/SensorGateway/SmartSwitchController.py

+ 1 - 29
Controller/SensorGateway/SmartSwitchController.py

@@ -44,9 +44,7 @@ class SmartSwitchView(View):
         else:
             if token_code != 0:
                 return response.json(token_code)
-            if operation == 'get-switch-info':  # 设备获取智能开关数据
-                return self.get_switch_info(request_dict, response)
-            elif operation == 'get-dimming-setting':  # 获取智能开关调光设置
+            if operation == 'get-dimming-setting':  # 获取智能开关调光设置
                 return self.get_dimming_setting(request_dict, response)
             elif operation == 'get-chronopher-setting':  # 获取定时计划
                 return self.get_chronopher_setting(request_dict, response)
@@ -63,32 +61,6 @@ class SmartSwitchView(View):
             else:
                 return response.json(414)
 
-    @staticmethod
-    def get_switch_info(request_dict, response):
-        """
-        获取智能开关设备信息
-        @param request_dict: 请求参数
-        @request_dict deviceId: 设备id
-        @param response: 响应对象
-        @return: response
-        """
-        device_id = request_dict.get('deviceId', None)
-        if not device_id:
-            return response.json(444)
-        try:
-            switch_info_qs = SwitchInfo.objects.filter(device_id=device_id).values()
-            if not switch_info_qs.exists():
-                return response.json(173)
-            res = {
-                'model': switch_info_qs[0]['model'],
-                'hardwareVersion': switch_info_qs[0]['hardware_version'],
-                'firmwareVersion': switch_info_qs[0]['firmware_version'],
-                'mac': switch_info_qs[0]['mac'],
-            }
-            return response.json(0, res)
-        except Exception as e:
-            print(e)
-            return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
 
     @staticmethod
     def get_dimming_setting(request_dict, response):