|
@@ -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)))
|