Selaa lähdekoodia

修改语音提示、设备通道增加算法类型区分

zhangdongming 2 vuotta sitten
vanhempi
commit
ae54cc61df
2 muutettua tiedostoa jossa 21 lisäystä ja 20 poistoa
  1. 5 11
      Controller/UidSetController.py
  2. 16 9
      Controller/VoicePromptController.py

+ 5 - 11
Controller/UidSetController.py

@@ -431,6 +431,7 @@ class UidSetView(View):
         end_time = request_dict.get('end_time', None)
         end_time = request_dict.get('end_time', None)
         repeat_day = request_dict.get('repeat_day', None)
         repeat_day = request_dict.get('repeat_day', None)
         direction = request_dict.get('direction', None)
         direction = request_dict.get('direction', None)
+        algorithm_type = request_dict.get('algorithmType', None)
 
 
         if uid and channel:
         if uid and channel:
             channel = int(channel)
             channel = int(channel)
@@ -440,41 +441,34 @@ class UidSetView(View):
                 ucs = {}
                 ucs = {}
                 if enter_voice:
                 if enter_voice:
                     ucs['voice_prompt_enter'] = enter_voice
                     ucs['voice_prompt_enter'] = enter_voice
-
                 if leave_voice:
                 if leave_voice:
                     ucs['voice_prompt_leave'] = leave_voice
                     ucs['voice_prompt_leave'] = leave_voice
-
                 if voice_status:
                 if voice_status:
                     ucs['voice_prompt_status'] = voice_status
                     ucs['voice_prompt_status'] = voice_status
-
                 if intelligent_mute:
                 if intelligent_mute:
                     ucs['voice_prompt_intelligent_mute'] = intelligent_mute
                     ucs['voice_prompt_intelligent_mute'] = intelligent_mute
-
                 if start_x:
                 if start_x:
                     ucs['voice_start_x'] = start_x
                     ucs['voice_start_x'] = start_x
-
                 if start_y:
                 if start_y:
                     ucs['voice_start_y'] = start_y
                     ucs['voice_start_y'] = start_y
-
                 if end_x:
                 if end_x:
                     ucs['voice_end_x'] = end_x
                     ucs['voice_end_x'] = end_x
-
                 if end_y:
                 if end_y:
                     ucs['voice_end_y'] = end_y
                     ucs['voice_end_y'] = end_y
-
                 if start_time:
                 if start_time:
                     ucs['voice_start_time'] = start_time
                     ucs['voice_start_time'] = start_time
-
                 if end_time:
                 if end_time:
                     ucs['voice_end_time'] = end_time
                     ucs['voice_end_time'] = end_time
-
                 if repeat_day:
                 if repeat_day:
                     ucs['voice_repeat_day'] = repeat_day
                     ucs['voice_repeat_day'] = repeat_day
-
                 if direction:
                 if direction:
                     ucs['voice_direction'] = direction
                     ucs['voice_direction'] = direction
+                if algorithm_type:
+                    ucs['algorithm_type'] = int(algorithm_type)
 
 
                 uid_channel_set_qs = UidChannelSetModel.objects.filter(uid__uid=uid, channel=channel)
                 uid_channel_set_qs = UidChannelSetModel.objects.filter(uid__uid=uid, channel=channel)
+                if algorithm_type:  # 算法类型
+                    uid_channel_set_qs.filter(algorithm_type=algorithm_type)
                 if not uid_channel_set_qs.exists():
                 if not uid_channel_set_qs.exists():
                     uidObject = UidSetModel.objects.filter(uid=uid)
                     uidObject = UidSetModel.objects.filter(uid=uid)
                     ucs['channel'] = channel
                     ucs['channel'] = channel

+ 16 - 9
Controller/VoicePromptController.py

@@ -64,9 +64,13 @@ class VoicePromptView(View):
         uid = request_dict.get('uid', None)
         uid = request_dict.get('uid', None)
         channel = request_dict.get('channel', None)
         channel = request_dict.get('channel', None)
         type = request_dict.get('type', None)
         type = request_dict.get('type', None)
+        algorithm_type = request_dict.get('algorithmType', None)
 
 
         if upload_type and uid and channel:
         if upload_type and uid and channel:
-            count = VoicePromptModel.objects.filter(uid=uid, channel=channel, type=type).count()
+            vp_qs = VoicePromptModel.objects.filter(uid=uid, channel=channel, type=type)
+            if algorithm_type:
+                vp_qs.filter(algorithm_type=int(algorithm_type))
+            count = vp_qs.count()
             if count >= 3:
             if count >= 3:
                 return response.json(201)
                 return response.json(201)
 
 
@@ -88,6 +92,7 @@ class VoicePromptView(View):
         lang = request_dict.get('lang', '')
         lang = request_dict.get('lang', '')
         uid = request_dict.get('uid', None)
         uid = request_dict.get('uid', None)
         channel = request_dict.get('channel', None)
         channel = request_dict.get('channel', None)
+        algorithm_type = request_dict.get('algorithmType', None)
 
 
         if filename and title and type and uid and channel:
         if filename and title and type and uid and channel:
             voice_prompt = VoicePromptModel()
             voice_prompt = VoicePromptModel()
@@ -99,6 +104,8 @@ class VoicePromptView(View):
             voice_prompt.uid = uid
             voice_prompt.uid = uid
             voice_prompt.channel = channel
             voice_prompt.channel = channel
             voice_prompt.add_time = int(time.time())
             voice_prompt.add_time = int(time.time())
+            if algorithm_type:
+                voice_prompt.algorithm_type = int(algorithm_type)
             voice_prompt.save()
             voice_prompt.save()
 
 
             res = {
             res = {
@@ -145,7 +152,6 @@ class VoicePromptView(View):
         elif ids:
         elif ids:
             voice_qs = VoicePromptModel.objects.filter(id__in=ids.split(','))
             voice_qs = VoicePromptModel.objects.filter(id__in=ids.split(','))
 
 
-
         if not voice_qs.exists():
         if not voice_qs.exists():
             return response.json(14)
             return response.json(14)
 
 
@@ -171,11 +177,16 @@ class VoicePromptView(View):
         lang = request_dict.get('lang', None)
         lang = request_dict.get('lang', None)
         uid = request_dict.get('uid', None)
         uid = request_dict.get('uid', None)
         channel = request_dict.get('channel', None)
         channel = request_dict.get('channel', None)
+        # 个性语音增加算法类型区分默认0兼容老版本
+        algorithm_type = int(request_dict.get('algorithmType', 0))
 
 
         if uid and channel and lang:
         if uid and channel and lang:
-            voice_qs = VoicePromptModel.objects.filter(uid=uid, channel=channel, classification=1)
-            system_qs = VoicePromptModel.objects.filter(classification=0, language=lang, status=1)
-            channel_qs = UidChannelSetModel.objects.filter(uid__uid=uid, channel=channel)
+            voice_qs = VoicePromptModel.objects.filter(uid=uid, channel=channel, classification=1,
+                                                       algorithm_type=algorithm_type)
+            system_qs = VoicePromptModel.objects.filter(classification=0, language=lang, status=1,
+                                                        algorithm_type=algorithm_type)
+            channel_qs = UidChannelSetModel.objects.filter(uid__uid=uid, channel=channel,
+                                                           algorithm_type=algorithm_type)
 
 
             res = {
             res = {
                 'enter_voice': {},
                 'enter_voice': {},
@@ -373,7 +384,3 @@ class VoicePromptView(View):
             return response.json(0)
             return response.json(0)
         else:
         else:
             return response.json(444)
             return response.json(444)
-
-
-
-