|
@@ -392,12 +392,14 @@ class IcloudServiceView(View):
|
|
LOGGER.info('删除云盘记录')
|
|
LOGGER.info('删除云盘记录')
|
|
start_time = request_dict.get('start_time', None)
|
|
start_time = request_dict.get('start_time', None)
|
|
end_time = request_dict.get('end_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)
|
|
file_type = request_dict.get('file_type', None)
|
|
page = request_dict.get('page', None)
|
|
page = request_dict.get('page', None)
|
|
line = request_dict.get('line', None)
|
|
line = request_dict.get('line', None)
|
|
if not all([page, line]):
|
|
if not all([page, line]):
|
|
return response.json(444, {'error param': 'page, line'})
|
|
return response.json(444, {'error param': 'page, line'})
|
|
|
|
+ uid_list = uid.split(',')
|
|
|
|
+ file_type_list = file_type.split(',')
|
|
page = int(page)
|
|
page = int(page)
|
|
line = int(line)
|
|
line = int(line)
|
|
now_time = int(time.time())
|
|
now_time = int(time.time())
|
|
@@ -413,10 +415,10 @@ class IcloudServiceView(View):
|
|
icloud_record_qs = IcloudStorageRecord.objects.filter(user_id=user_id)
|
|
icloud_record_qs = IcloudStorageRecord.objects.filter(user_id=user_id)
|
|
if start_time and end_time: # 按时间段查询
|
|
if start_time and end_time: # 按时间段查询
|
|
icloud_record_qs = icloud_record_qs.filter(time_stamp__gte=start_time, time_stamp__lt=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: # 按文件类型查询
|
|
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',
|
|
icloud_record_qs = icloud_record_qs.values('bucket_id', 'sec', 'fg', 'nickname', 'uid', 'channel', 'size', 'id',
|
|
'time_stamp', 'file_type').order_by('-time_stamp')[
|
|
'time_stamp', 'file_type').order_by('-time_stamp')[
|
|
(page - 1) * line:page * line]
|
|
(page - 1) * line:page * line]
|
|
@@ -444,11 +446,12 @@ class IcloudServiceView(View):
|
|
total_size += float(item['size'])
|
|
total_size += float(item['size'])
|
|
uid_token = TokenObject().encryption(data={'uid': uid, 'user_id': user_id})
|
|
uid_token = TokenObject().encryption(data={'uid': uid, 'user_id': user_id})
|
|
res_data = {
|
|
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,
|
|
'time_stamp': time_stamp,
|
|
'icloud_id': item['id'],
|
|
'icloud_id': item['id'],
|
|
'file_type': file_type,
|
|
'file_type': file_type,
|
|
- 'nick_name': item['nickname']
|
|
|
|
|
|
+ 'nick_name': item['nickname'],
|
|
|
|
+ 'uid': uid
|
|
}
|
|
}
|
|
if file_type == 0: # 图片,只返回图片地址
|
|
if file_type == 0: # 图片,只返回图片地址
|
|
thumbs_png = '{user_id}/image_file/{uid}/channel{channel}/{time}/{time}.jpeg'.format(
|
|
thumbs_png = '{user_id}/image_file/{uid}/channel{channel}/{time}/{time}.jpeg'.format(
|