|
@@ -41,7 +41,7 @@ class CronCloudPhotoView(View):
|
|
|
if token.code != 0:
|
|
|
return response.json(token.code)
|
|
|
user_id = token.userID
|
|
|
- if operation == 'get-photo':
|
|
|
+ if operation == 'save-photo':
|
|
|
return self.save_cloud_photo(user_id, request_dict, response)
|
|
|
elif operation == 'bgm-list':
|
|
|
return self.get_bgm_list(response)
|
|
@@ -63,7 +63,8 @@ class CronCloudPhotoView(View):
|
|
|
uid = request_dict.get('uid', None)
|
|
|
if not all([status, uid, user_id]):
|
|
|
return response(444)
|
|
|
- device_info_qs = Device_Info.objects.filter(vodPrimaryUserID=user_id, uid=uid).values('primaryUserID')
|
|
|
+ status = int(status)
|
|
|
+ device_info_qs = Device_Info.objects.filter(userID_id=user_id, UID=uid).values('primaryUserID')
|
|
|
if not device_info_qs.exists():
|
|
|
return response.json(14)
|
|
|
master_user_id = device_info_qs[0]['primaryUserID']
|
|
@@ -107,6 +108,10 @@ class CronCloudPhotoView(View):
|
|
|
end_time = request_dict.get('endTime', None)
|
|
|
page = request_dict.get('page', None)
|
|
|
size = request_dict.get('size', None)
|
|
|
+ if not all([page, size]):
|
|
|
+ return response.json(444)
|
|
|
+ page = int(page)
|
|
|
+ size = int(size)
|
|
|
video_qs = DevicePicturePushInfo.objects.filter(user_id=user_id, type=1)
|
|
|
if device_name:
|
|
|
video_qs = video_qs.filter(device_nick_name__icontains=device_name)
|
|
@@ -143,12 +148,12 @@ class CronCloudPhotoView(View):
|
|
|
ids = request_dict.get('ids', None)
|
|
|
if not ids:
|
|
|
return response.json(444)
|
|
|
- cloud_photo_qs = DevicePicturePushInfo.objects.filter(id__in=ids.split(',')).values('uid', 'event_time')
|
|
|
+ cloud_photo_qs = DevicePicturePushInfo.objects.filter(id__in=ids.split(','))
|
|
|
if not cloud_photo_qs.exists():
|
|
|
return response.json(173)
|
|
|
s3 = AmazonS3Util(ACCESS_KEY_ID, SECRET_ACCESS_KEY, REGION_NAME)
|
|
|
for item in cloud_photo_qs:
|
|
|
- key = '{}/video/{}.mp4'.format(item['uid'], str(item['event_time']))
|
|
|
+ key = '{}/video/{}.mp4'.format(item.uid, str(item.event_time))
|
|
|
s3.delete_obj(PUSH_CLOUD_PHOTO, key)
|
|
|
cloud_photo_qs.delete()
|
|
|
return response.json(0)
|