|
@@ -26,7 +26,7 @@ from django.views.decorators.csrf import csrf_exempt
|
|
from django.views.generic.base import View
|
|
from django.views.generic.base import View
|
|
import urllib
|
|
import urllib
|
|
|
|
|
|
-from Ansjer.config import OSS_BUCKET_ENDPOINT, OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, \
|
|
|
|
|
|
+from Ansjer.config import OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, \
|
|
OSS_REGION_ID, OSS_ROLE_ARN, SERVER_DOMAIN
|
|
OSS_REGION_ID, OSS_ROLE_ARN, SERVER_DOMAIN
|
|
from Model.models import Device_Meal, Device_Info, Order_Model, Store_Meal, VodHlsModel, OssCrdModel
|
|
from Model.models import Device_Meal, Device_Info, Order_Model, Store_Meal, VodHlsModel, OssCrdModel
|
|
from Object.ResponseObject import ResponseObject
|
|
from Object.ResponseObject import ResponseObject
|
|
@@ -195,7 +195,7 @@ class CloudVodView(View):
|
|
channel = utko.channel
|
|
channel = utko.channel
|
|
print(channel)
|
|
print(channel)
|
|
print(UID)
|
|
print(UID)
|
|
- qs = Device_Meal.objects.filter(uid=UID, channel=channel, status=1).values("channel", "end_time","rank__bucket__bucket")
|
|
|
|
|
|
+ qs = Device_Meal.objects.filter(uid=UID, channel=channel, status=1).values("channel", "end_time","rank__bucket__bucket","rank__bucket__endpoint")
|
|
if not qs.exists():
|
|
if not qs.exists():
|
|
res = {'code': 403}
|
|
res = {'code': 403}
|
|
return JsonResponse(status=200, data=res)
|
|
return JsonResponse(status=200, data=res)
|
|
@@ -217,7 +217,7 @@ class CloudVodView(View):
|
|
# 套餐id
|
|
# 套餐id
|
|
storage = '{uid}/vod{channel}/'.format(uid=UID, channel=channel)
|
|
storage = '{uid}/vod{channel}/'.format(uid=UID, channel=channel)
|
|
bucket_name = qs[0]['rank__bucket__bucket']
|
|
bucket_name = qs[0]['rank__bucket__bucket']
|
|
- endpoint = OSS_BUCKET_ENDPOINT
|
|
|
|
|
|
+ endpoint = qs[0]['rank__bucket__endpoint']
|
|
access_key_id = OSS_STS_ACCESS_KEY
|
|
access_key_id = OSS_STS_ACCESS_KEY
|
|
access_key_secret = OSS_STS_ACCESS_SECRET
|
|
access_key_secret = OSS_STS_ACCESS_SECRET
|
|
region_id = OSS_REGION_ID
|
|
region_id = OSS_REGION_ID
|
|
@@ -288,15 +288,16 @@ class CloudVodView(View):
|
|
if not qs.exists():
|
|
if not qs.exists():
|
|
return response.json(13)
|
|
return response.json(13)
|
|
uid = qs[0]['UID']
|
|
uid = qs[0]['UID']
|
|
- dm_qs = Device_Meal.objects.filter(uid=uid, channel=channel).values('rank__bucket__bucket','end_time')
|
|
|
|
|
|
+ dm_qs = Device_Meal.objects.filter(uid=uid, channel=channel).values('rank__bucket__bucket','end_time','rank__bucket__endpoint')
|
|
now_time = timezone.localtime(timezone.now())
|
|
now_time = timezone.localtime(timezone.now())
|
|
if now_time > dm_qs[0]['end_time']:
|
|
if now_time > dm_qs[0]['end_time']:
|
|
return response.json(10, '已过期')
|
|
return response.json(10, '已过期')
|
|
if not dm_qs.exists():
|
|
if not dm_qs.exists():
|
|
return response.json(10, '未开通云存储')
|
|
return response.json(10, '未开通云存储')
|
|
bucket_name = dm_qs[0]["rank__bucket__bucket"]
|
|
bucket_name = dm_qs[0]["rank__bucket__bucket"]
|
|
|
|
+ endpoint = dm_qs[0]["rank__bucket__endpoint"]
|
|
auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
|
|
auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
|
|
- bucket = oss2.Bucket(auth, OSS_BUCKET_ENDPOINT, bucket_name)
|
|
|
|
|
|
+ bucket = oss2.Bucket(auth, endpoint, bucket_name)
|
|
vod_play_list = []
|
|
vod_play_list = []
|
|
prefix = '{uid}/vod{channel}/{daytime}/'.format(uid=uid, channel=channel, daytime=daytime, hour=hour)
|
|
prefix = '{uid}/vod{channel}/{daytime}/'.format(uid=uid, channel=channel, daytime=daytime, hour=hour)
|
|
|
|
|