Browse Source

Merge branch 'test' of http://192.168.136.99:3000/servers/ASJServer into ming

zhangdongming 1 year ago
parent
commit
3a7a5da56b
1 changed files with 4 additions and 6 deletions
  1. 4 6
      Controller/SensorGateway/SmartSwitchController.py

+ 4 - 6
Controller/SensorGateway/SmartSwitchController.py

@@ -430,10 +430,8 @@ class SmartSwitchView(View):
             redis_obj = RedisObject()
             timer_info = redis_obj.get_all_hash_data(key)
             if not timer_info:
-                res = {'timePoint': -1, 'countdownTime': -1, 'actions': -1, 'timerStatus': -1}
-            else:
-                res = timer_info
-            return response.json(0, res)
+                return response.json(173)
+            return response.json(0, timer_info)
         except Exception as e:
             print(e)
             return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
@@ -487,14 +485,14 @@ class SmartSwitchView(View):
                         redis_dict['timePoint'] = -1
                         redis_obj.set_hash_data(key, redis_dict)
                         redis_obj.set_persist(key)
-                        return response.json(0)
+                        return response.json(0, redis_dict)
                 redis_obj.set_hash_data(key, redis_dict)
                 redis_obj.set_expire(key, countdown_time)
                 msg = {'device_switch': actions, 'task_id': task_id}
                 celery_obj.creat_clocked_task(task_id, MQTT_TASK, implement_time, tz,
                                               args=[serial_number, topic_name, msg, task_id, 2,
                                                     device_id, json.dumps(redis_dict)])
-                return response.json(0)
+                return response.json(0, redis_dict)
         except Exception as e:
             print(e)
             return response.json(500, 'error_line:{}, error_msg:{}'.format(e.__traceback__.tb_lineno, repr(e)))