|
@@ -32,28 +32,29 @@ class SmartSwitchView(View):
|
|
|
|
|
|
def validation(self, request_dict, request, operation):
|
|
|
token_code, user_id, response = CommonService.verify_token_get_user_id(request_dict, request)
|
|
|
- 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': # 获取智能开关调光设置
|
|
|
- return self.get_dimming_setting(request_dict, response)
|
|
|
- elif operation == 'get-chronopher-setting': # 获取定时计划
|
|
|
- return self.get_chronopher_setting(request_dict, response)
|
|
|
- elif operation == 'add-or-edit-chronopher': # 添加/编辑定时计划
|
|
|
- return self.add_or_edit_chronopher(request_dict, response)
|
|
|
- elif operation == 'delete-chronopher': # 删除定时计划
|
|
|
- return self.delete_chronopher(request_dict, response)
|
|
|
- elif operation == 'edit-dimming-correction': # 设置调光校正
|
|
|
- return self.edit_dimming_correction(request_dict, response)
|
|
|
- elif operation == 'edit-dimming-setting': # 修改智能开关调光设置
|
|
|
- return self.edit_dimming_setting(request_dict, response)
|
|
|
+ if operation == 'switch-report-log': # 设备上报执行日志
|
|
|
+ return self.create_log(request_dict, response)
|
|
|
elif operation == 'reset': # 设备重置
|
|
|
return self.reset(request_dict, response)
|
|
|
- elif operation == 'switch-report-log': # 设备上报执行日志
|
|
|
- return self.create_log(request_dict, response)
|
|
|
else:
|
|
|
- return response.json(414)
|
|
|
+ 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': # 获取智能开关调光设置
|
|
|
+ return self.get_dimming_setting(request_dict, response)
|
|
|
+ elif operation == 'get-chronopher-setting': # 获取定时计划
|
|
|
+ return self.get_chronopher_setting(request_dict, response)
|
|
|
+ elif operation == 'add-or-edit-chronopher': # 添加/编辑定时计划
|
|
|
+ return self.add_or_edit_chronopher(request_dict, response)
|
|
|
+ elif operation == 'delete-chronopher': # 删除定时计划
|
|
|
+ return self.delete_chronopher(request_dict, response)
|
|
|
+ elif operation == 'edit-dimming-correction': # 设置调光校正
|
|
|
+ return self.edit_dimming_correction(request_dict, response)
|
|
|
+ elif operation == 'edit-dimming-setting': # 修改智能开关调光设置
|
|
|
+ return self.edit_dimming_setting(request_dict, response)
|
|
|
+ else:
|
|
|
+ return response.json(414)
|
|
|
|
|
|
@staticmethod
|
|
|
def get_switch_info(request_dict, response):
|