Browse Source

定制推送增加搜索功能

keiSenFront 1 year ago
parent
commit
e8d8f47540
1 changed files with 15 additions and 1 deletions
  1. 15 1
      AdminController/UserManageController.py

+ 15 - 1
AdminController/UserManageController.py

@@ -893,6 +893,10 @@ class UserManagement(View):
 
     @staticmethod
     def getCustomizedPushList(request_dict, response):
+        title = request_dict.get('title', None)
+        country = request_dict.get('country', None)
+        device_type = request_dict.get('device_type', None)
+        push_satus = request_dict.get('push_satus', None)
         page = request_dict.get('pageNo', None)
         line = request_dict.get('pageSize', None)
 
@@ -903,7 +907,17 @@ class UserManagement(View):
         line = int(line)
 
         try:
-            customized_push_qs = CustomizedPush.objects.filter()
+            customized_push_qs = CustomizedPush.objects.all()
+            if title:
+                customized_push_qs = customized_push_qs.filter(title=title)
+            if country:
+                customized_push_qs = customized_push_qs.filter(country=country)
+            if device_type:
+                customized_push_qs = customized_push_qs.filter(device_type__contains=device_type)
+            if push_satus:
+                customized_push_qs = customized_push_qs.filter(push_satus=push_satus)
+            if not customized_push_qs.exists():
+                return response.json(0, [])
             total = customized_push_qs.count()
             customized_push_qs = customized_push_qs.\
                 values('id', 'title', 'msg', 'link', 'icon_link', 'country', 'device_type', 'register_period',