Browse Source

优化查询通道设置默认值

zhangdongming 2 years ago
parent
commit
665fd2d186
1 changed files with 3 additions and 5 deletions
  1. 3 5
      Controller/UidSetController.py

+ 3 - 5
Controller/UidSetController.py

@@ -427,7 +427,7 @@ class UidSetView(View):
         end_time = request_dict.get('end_time', None)
         repeat_day = request_dict.get('repeat_day', None)
         direction = request_dict.get('direction', None)
-        algorithm_type = request_dict.get('algorithmType', None)
+        algorithm_type = int(request_dict.get('algorithmType', 0))
 
         if uid and channel:
             channel = int(channel)
@@ -459,12 +459,10 @@ class UidSetView(View):
                     ucs['voice_repeat_day'] = repeat_day
                 if direction:
                     ucs['voice_direction'] = direction
-                if algorithm_type:
-                    ucs['algorithm_type'] = int(algorithm_type)
+                ucs['algorithm_type'] = algorithm_type
 
                 uid_channel_set_qs = UidChannelSetModel.objects.filter(uid__uid=uid, channel=channel)
-                if algorithm_type:  # 算法类型
-                    uid_channel_set_qs.filter(algorithm_type=int(algorithm_type))
+                uid_channel_set_qs = uid_channel_set_qs.filter(algorithm_type=algorithm_type)
                 if not uid_channel_set_qs.exists():
                     uidObject = UidSetModel.objects.filter(uid=uid)
                     ucs['channel'] = channel