|
@@ -204,10 +204,14 @@ class CloudStorageView(View):
|
|
|
channel = request_dict.get('channel', None)
|
|
|
storeTime = request_dict.get('time', None)
|
|
|
now_time = int(time.time())
|
|
|
- vh_qs = VodHlsModel.objects.filter(uid=uid, channel=channel, time=int(storeTime), endTime__gte=now_time). \
|
|
|
+ print(uid)
|
|
|
+ print(channel)
|
|
|
+ print(storeTime)
|
|
|
+ print(now_time)
|
|
|
+ vh_qs = VodHlsModel.objects.filter(uid=uid, channel=channel, time=storeTime, endTime__gte=now_time). \
|
|
|
values("sec", "fg", "bucket__bucket", "bucket__endpoint", "bucket__region", "bucket__mold")
|
|
|
if not vh_qs.exists():
|
|
|
- return response.json()
|
|
|
+ return response.json(11,'不存在')
|
|
|
sec = vh_qs[0]['sec']
|
|
|
fg = vh_qs[0]['fg']
|
|
|
bucket__region = vh_qs[0]['bucket__region']
|
|
@@ -342,7 +346,7 @@ class CloudStorageView(View):
|
|
|
res = json.loads(sts_qs[0]["data"])
|
|
|
return JsonResponse(status=200, data=res)
|
|
|
# 套餐id
|
|
|
- # storage = '{uid}/vod{channel}/'.format(uid=uid, channel=channel)
|
|
|
+ storage = '{uid}/vod{channel}/'.format(uid=uid, channel=channel)
|
|
|
bucket_name = ubqs[0]['bucket__bucket']
|
|
|
endpoint = ubqs[0]['bucket__endpoint']
|
|
|
region_id = ubqs[0]['bucket__region']
|
|
@@ -363,8 +367,8 @@ class CloudStorageView(View):
|
|
|
{
|
|
|
"Effect": "Allow",
|
|
|
"Action": "s3:*",
|
|
|
- "Resource": ["arn:aws:s3:::{bucket_name}/{uid}/*".
|
|
|
- format(bucket_name=bucket_name,uid=uid)]
|
|
|
+ "Resource": ["arn:aws:s3:::{bucket_name}/{uid_channel}/*".
|
|
|
+ format(bucket_name=bucket_name,uid_channel=storage)]
|
|
|
}
|
|
|
]
|
|
|
}
|
|
@@ -385,7 +389,7 @@ class CloudStorageView(View):
|
|
|
'bucket_name': bucket_name,
|
|
|
'arn': response['FederatedUser']['Arn'],
|
|
|
'code': 0,
|
|
|
- 'storage': uid,
|
|
|
+ 'storage': storage,
|
|
|
'endTime': ubqs[0]['endTime'],
|
|
|
'ip': ip,
|
|
|
}
|