|
@@ -477,11 +477,10 @@ class CloudStorageView(View):
|
|
|
})
|
|
|
|
|
|
device_info_qs = Device_Info.objects.filter(userID_id=user_id, UID=uid, isShare=False).values(
|
|
|
- 'vodPrimaryUserID',
|
|
|
- 'vodPrimaryMaster')
|
|
|
+ 'vodPrimaryUserID', 'Type', 'vodPrimaryMaster')
|
|
|
if not device_info_qs.exists():
|
|
|
return response.json(12)
|
|
|
-
|
|
|
+ device_type = device_info_qs[0]['Type']
|
|
|
device_info_qs_time_over = int(time.time())
|
|
|
if uid == 'UWE2ZJ52SE4FX75U111A':
|
|
|
logger.info({
|
|
@@ -492,8 +491,10 @@ class CloudStorageView(View):
|
|
|
if device_info_qs[0]['vodPrimaryUserID'] != user_id:
|
|
|
return response.json(10034)
|
|
|
now_time = int(time.time())
|
|
|
- uid_bucket_qs = UID_Bucket.objects.filter(uid=uid, endTime__gte=now_time, channel=channel).values(
|
|
|
- 'bucket_id').order_by('addTime')
|
|
|
+ if device_type == 34: # 枪球设备开通云存不区分通道
|
|
|
+ uid_bucket_qs = UID_Bucket.objects.filter(uid=uid, endTime__gte=now_time)
|
|
|
+ else:
|
|
|
+ uid_bucket_qs = UID_Bucket.objects.filter(uid=uid, endTime__gte=now_time, channel=channel)
|
|
|
if not uid_bucket_qs.exists():
|
|
|
return response.json(10030)
|
|
|
|
|
@@ -682,18 +683,23 @@ class CloudStorageView(View):
|
|
|
if not all([uid, status, channel]):
|
|
|
return response.json(444, 'uid,status,channel')
|
|
|
device_info_qs = Device_Info.objects.filter(userID_id=user_id, UID=uid, isShare=False, isExist=1).values(
|
|
|
- 'vodPrimaryUserID')
|
|
|
+ 'vodPrimaryUserID', 'Type')
|
|
|
if not device_info_qs.exists() or device_info_qs[0]['vodPrimaryUserID'] != user_id:
|
|
|
return response.json(12)
|
|
|
- uid_bucket_qs = UID_Bucket.objects.filter(channel=channel, uid=uid)
|
|
|
+ device_type = device_info_qs[0]['Type']
|
|
|
+ if device_type == 34: # 枪球设备开通云存不区分通道
|
|
|
+ uid_bucket_qs = UID_Bucket.objects.filter(uid=uid)
|
|
|
+ else:
|
|
|
+ uid_bucket_qs = UID_Bucket.objects.filter(channel=channel, uid=uid)
|
|
|
if not uid_bucket_qs.exists():
|
|
|
return response.json(10030)
|
|
|
now_time = int(time.time())
|
|
|
if now_time > uid_bucket_qs[0].endTime:
|
|
|
return response.json(10031)
|
|
|
- uid_bucket_qs.update(status=status)
|
|
|
if status == 0:
|
|
|
+ uid_bucket_qs.update(status=status)
|
|
|
return response.json(0)
|
|
|
+ uid_bucket_qs.update(status=status, channel=channel)
|
|
|
uid_obj = UidTokenObject()
|
|
|
uid_obj.generate(data={'uid': uid, 'channel': channel})
|
|
|
|
|
@@ -738,10 +744,14 @@ class CloudStorageView(View):
|
|
|
'vodPrimaryUserID', 'Type')
|
|
|
if not device_info_qs.exists() or device_info_qs[0]['vodPrimaryUserID'] != user_id:
|
|
|
return response.json(12)
|
|
|
+ device_type = device_info_qs[0]['Type']
|
|
|
uid_set_qs = UidSetModel.objects.filter(uid=uid)
|
|
|
if not uid_set_qs.exists():
|
|
|
return response.json(12)
|
|
|
- uid_bucket_qs = UID_Bucket.objects.filter(channel=channel, uid=uid)
|
|
|
+ if device_type == 34: # 枪球设备开通云存不区分通道
|
|
|
+ uid_bucket_qs = UID_Bucket.objects.filter(uid=uid)
|
|
|
+ else:
|
|
|
+ uid_bucket_qs = UID_Bucket.objects.filter(channel=channel, uid=uid)
|
|
|
if not uid_bucket_qs.exists():
|
|
|
return response.json(10030)
|
|
|
now_time = int(time.time())
|
|
@@ -750,11 +760,12 @@ class CloudStorageView(View):
|
|
|
return response.json(10031)
|
|
|
try:
|
|
|
with transaction.atomic():
|
|
|
- uid_bucket_qs.update(status=vod_status)
|
|
|
if vod_status == 0:
|
|
|
+ uid_bucket_qs.update(status=vod_status)
|
|
|
ai_status = '0'
|
|
|
if uid_set_qs[0].is_ai == 2:
|
|
|
return response.json(0)
|
|
|
+ uid_bucket_qs.update(status=vod_status, channel=channel)
|
|
|
uid_obj = UidTokenObject()
|
|
|
uid_obj.generate(data={'uid': uid, 'channel': channel})
|
|
|
|