Эх сурвалжийг харах

优化开启推送设置默认60秒推一次

zhangdongming 1 жил өмнө
parent
commit
a6b60c2144

+ 4 - 2
Controller/DetectControllerV2.py

@@ -152,9 +152,12 @@ class DetectControllerViewV2(View):
             # 检测类型
             if detect_group:
                 uid_set_data['detect_group'] = detect_group
+            uid_set_qs = UidSetModel.objects.filter(uid=uid)
             # 设置消息推送间隔
             if interval:
                 interval = int(interval)
+                if uid_set_qs.exists() and status == 1 and uid_set_qs.first().detect_status == 0:
+                    interval = 60
                 uid_set_data['detect_interval'] = interval
                 # 开通了ai服务的设备,通过mqtt通知设备修改消息推送间隔
                 ai_service_qs = AiService.objects.filter(uid=uid, use_status=1, endTime__gte=nowTime)
@@ -168,13 +171,12 @@ class DetectControllerViewV2(View):
                     }
                     CommonService.req_publish_mqtt_msg(uid, topic_name, msg)
 
-            uid_set_qs = UidSetModel.objects.filter(uid=uid)
             if uid_set_qs.exists():
                 msg_data = uid_set_qs.first().msg_notify
                 if status == 0 and msg_data:
                     msg_data['appPush'] = -1
                     uid_set_data['msg_notify'] = msg_data
-                elif status == 1:
+                elif status == 1 and uid_set_qs.first().detect_status == 0:
                     msg_data = {'appPush': 1,
                                 'pushTime': {'allDay': 1, 'repeat': 127, 'endTime': 0, 'timeZone': '+08.00',
                                              'startTime': 0},