Browse Source

优化定时器

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

+ 5 - 1
Controller/SensorGateway/SmartSwitchController.py

@@ -494,9 +494,13 @@ class SmartSwitchView(View):
                         timer_exist = redis_obj.get_all_hash_data(key)
                         if timer_exist:
                             if int(timer_id) != int(timer_exist[b'timerId']):
-                                return response.json(174)
+                                return response.json(173)
                             else:
                                 redis_dict['timerId'] = int(timer_exist[b'timerId']) + 1
+                else:
+                    timer_exist = redis_obj.get_all_hash_data(key)
+                    if timer_exist:
+                        return response.json(174)
                 redis_obj.set_hash_data(key, redis_dict)
                 redis_obj.set_expire(key, countdown_time)
                 msg = {'device_switch': actions, 'task_id': task_id}