瀏覽代碼

支持多选

peng 2 年之前
父節點
當前提交
ad77d56956
共有 1 個文件被更改,包括 9 次插入6 次删除
  1. 9 6
      Controller/IcloudService/IcloudService.py

+ 9 - 6
Controller/IcloudService/IcloudService.py

@@ -392,12 +392,14 @@ class IcloudServiceView(View):
         LOGGER.info('删除云盘记录')
         start_time = request_dict.get('start_time', None)
         end_time = request_dict.get('end_time', None)
-        nick_name = request_dict.get('nick_name', None)
+        uid = request_dict.get('uid', None)
         file_type = request_dict.get('file_type', None)
         page = request_dict.get('page', None)
         line = request_dict.get('line', None)
         if not all([page, line]):
             return response.json(444, {'error param': 'page, line'})
+        uid_list = uid.split(',')
+        file_type_list = file_type.split(',')
         page = int(page)
         line = int(line)
         now_time = int(time.time())
@@ -413,10 +415,10 @@ class IcloudServiceView(View):
         icloud_record_qs = IcloudStorageRecord.objects.filter(user_id=user_id)
         if start_time and end_time:  # 按时间段查询
             icloud_record_qs = icloud_record_qs.filter(time_stamp__gte=start_time, time_stamp__lt=end_time)
-        if nick_name:  # 按设备昵称查询
-            icloud_record_qs = icloud_record_qs.filter(nickname=nick_name)
+        if uid:  # 按设备昵称查询
+            icloud_record_qs = icloud_record_qs.filter(uid__in=uid_list)
         if file_type:  # 按文件类型查询
-            icloud_record_qs = icloud_record_qs.filter(file_type=file_type)
+            icloud_record_qs = icloud_record_qs.filter(file_type__in=file_type_list)
         icloud_record_qs = icloud_record_qs.values('bucket_id', 'sec', 'fg', 'nickname', 'uid', 'channel', 'size', 'id',
                                                    'time_stamp', 'file_type').order_by('-time_stamp')[
                            (page - 1) * line:page * line]
@@ -444,11 +446,12 @@ class IcloudServiceView(View):
                 total_size += float(item['size'])
                 uid_token = TokenObject().encryption(data={'uid': uid, 'user_id': user_id})
                 res_data = {
-                    'is_show': 1 if total_size < all_size else 0,  # 只展示剩余容量的数据,超过的部分不展示
+                    'is_show': 1 if total_size < all_size else 0,  # 只展示剩余容量的数据,超过的部分不展示,1:展示;0:不展示
                     'time_stamp': time_stamp,
                     'icloud_id': item['id'],
                     'file_type': file_type,
-                    'nick_name': item['nickname']
+                    'nick_name': item['nickname'],
+                    'uid': uid
                 }
                 if file_type == 0:  # 图片,只返回图片地址
                     thumbs_png = '{user_id}/image_file/{uid}/channel{channel}/{time}/{time}.jpeg'.format(