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

根据设备类型过滤设备音频

linhaohong 5 сар өмнө
parent
commit
f62f4591f6

+ 5 - 1
Controller/VoicePromptController.py

@@ -192,7 +192,11 @@ class VoicePromptView(View):
                                                             algorithm_type=algorithm_type)
                                                             algorithm_type=algorithm_type)
             if lang == 'cn' and algorithm_type == 10:
             if lang == 'cn' and algorithm_type == 10:
                 device_type = Device_Info.objects.filter(UID=uid).values('Type').first()['Type']
                 device_type = Device_Info.objects.filter(UID=uid).values('Type').first()['Type']
-                system_qs = system_qs.filter(Q(device_types=[]) | Q(device_types__contains=[device_type]))
+                system_new_qs = system_qs.filter(Q(device_types__contains=[device_type]))
+                if system_new_qs.exists():
+                    system_qs = system_new_qs
+                else:
+                    system_qs = system_qs.filter(Q(device_types=[]))
 
 
             channel_qs = UidChannelSetModel.objects.filter(uid__uid=uid, channel=channel,
             channel_qs = UidChannelSetModel.objects.filter(uid__uid=uid, channel=channel,
                                                            algorithm_type=algorithm_type)
                                                            algorithm_type=algorithm_type)