peng 1 жил өмнө
parent
commit
239fb6d221

+ 4 - 2
Controller/SensorGateway/SmartSwitchController.py

@@ -271,7 +271,7 @@ class SmartSwitchView(View):
         try:
             with transaction.atomic():
                 celery_obj = CeleryBeatObj()
-                if is_edit:
+                if is_edit == '1':
                     if not scheduler_id:
                         return response.json(444, {'param': 'schedulerId'})
                     update_flag = SwitchScheduler.objects.filter(device_id=device_id, id=scheduler_id).update(
@@ -431,6 +431,8 @@ class SmartSwitchView(View):
             timer_info = redis_obj.get_all_hash_data(key)
             if not timer_info:
                 return response.json(173)
+            for k, v in timer_info.items():
+                timer_info[k] = int(v)
             return response.json(0, timer_info)
         except Exception as e:
             print(e)
@@ -477,7 +479,7 @@ class SmartSwitchView(View):
                           'timerStatus': timer_status}
             with transaction.atomic():
                 celery_obj.del_task(task_id)
-                if is_edit:
+                if is_edit == '1':
                     if not timer_status:
                         return response.json(444, {'param': 'timerStatus'})
                     timer_status = int(timer_status)