|
@@ -40,20 +40,20 @@ from Service.ModelService import ModelService
|
|
|
http://192.168.136.40:8077/cloudVod/getSts?uidToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiJGVFNMTDhITTQzN1ozOFdVMTExQSIsImNoYW5uZWwiOiI0In0.HO-PzoRwhQ4CFNkjthqOitf48c-XOvHjtNGCeUmBe9g
|
|
|
# 获取存储的播放文件列表
|
|
|
#修改状态
|
|
|
-http://192.168.136.40:8077/cloudVod/status?token=local&did=138001380001543918745881545&channel=4&status=1
|
|
|
+http://192.168.136.40:8077/cloudVod/status?token=local&uid=xxx&channel=4&status=1
|
|
|
# 回调vod
|
|
|
http://192.168.136.40:8077/cloudVod/storeplaylist?uidToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiJGVFNMTDhITTQzN1ozOFdVMTExQSIsImNoYW5uZWwiOiI0In0.HO-PzoRwhQ4CFNkjthqOitf48c-XOvHjtNGCeUmBe9g&time=1234567891
|
|
|
=============================
|
|
|
# 生成订单
|
|
|
-http://test.dvema.com/cloudVod/createOrder?token=test&did=138001380001544514277661990&channel=4&rank=1
|
|
|
+http://test.dvema.com/cloudVod/createOrder?token=test&uid=xxx&channel=4&rank=1
|
|
|
# 修改设备云存状态
|
|
|
-http://test.dvema.com/cloudVod/status?did=138001380001544514277661990&channel=4&token=test&status=1
|
|
|
+http://test.dvema.com/cloudVod/status?uid=xxx&channel=4&token=test&status=1
|
|
|
|
|
|
# 获取指定设备云存关联信息
|
|
|
-http://test.dvema.com/cloudVod/details?token=test&did=138001380001540342559510534
|
|
|
+http://test.dvema.com/cloudVod/details?token=test&uid=xxxx
|
|
|
|
|
|
# 获取回放列表
|
|
|
-http://test.dvema.com/cloudVod/getHlsList?did=138001380001544514277661990&channel=4&token=test&daytime=2018121001
|
|
|
+http://test.dvema.com/cloudVod/getHlsList?uid=xxxx&channel=4&token=test&daytime=2018121001
|
|
|
|
|
|
|
|
|
2设备端
|
|
@@ -253,12 +253,11 @@ class CloudVodView(View):
|
|
|
return response.json(10, '生成订单错误')
|
|
|
|
|
|
def do_get_details(self, request_dict, response):
|
|
|
- did = request_dict.get('did', None)
|
|
|
- dvqs = Device_Info.objects.filter(id=did, isShare=False).values('UID')
|
|
|
+ uid = request_dict.get('uid', None)
|
|
|
+ dvqs = Device_Info.objects.filter(UID=uid, isShare=False)
|
|
|
if not dvqs.exists():
|
|
|
return response.json(12)
|
|
|
- UID = dvqs[0]['UID']
|
|
|
- ubqs = UID_Bucket.objects.filter(uid=UID). \
|
|
|
+ ubqs = UID_Bucket.objects.filter(uid=uid). \
|
|
|
values('bucket__content', 'status', 'channel', 'endTime', 'uid')
|
|
|
res = []
|
|
|
if ubqs.exists():
|
|
@@ -425,14 +424,14 @@ class CloudVodView(View):
|
|
|
return response
|
|
|
|
|
|
def do_create_order(self, request_dict, userID, response):
|
|
|
- did = request_dict.get('did', None)
|
|
|
+ uid = request_dict.get('uid', None)
|
|
|
rank = request_dict.get('rank', None)
|
|
|
channel = request_dict.get('channel', None)
|
|
|
- qs = Device_Info.objects.filter(userID_id=userID, id=did, isShare=False).values("UID")
|
|
|
+ if not uid or not channel or not rank:
|
|
|
+ return response.json(444, 'channel,rank')
|
|
|
+ qs = Device_Info.objects.filter(userID_id=userID, UID=uid, isShare=False)
|
|
|
if not qs.exists():
|
|
|
return response.json(12)
|
|
|
- if not did or not channel or not rank:
|
|
|
- return response.json(444, 'did,channel,rank')
|
|
|
smqs = Store_Meal.objects.filter(id=rank). \
|
|
|
values("currency", "price", "content", "day", "bucket__storeDay", "bucket__region")
|
|
|
if not smqs.exists():
|
|
@@ -441,7 +440,6 @@ class CloudVodView(View):
|
|
|
price = smqs[0]['price']
|
|
|
content = smqs[0]['content']
|
|
|
day = smqs[0]['day']
|
|
|
- uid = qs[0]['UID']
|
|
|
nowTime = int(time.time())
|
|
|
ubqs = UID_Bucket.objects.filter(uid=uid, channel=channel, endTime__gte=nowTime). \
|
|
|
values("bucket__storeDay", "bucket__region")
|
|
@@ -692,16 +690,15 @@ class CloudVodView(View):
|
|
|
return HttpResponseRedirect(red_url)
|
|
|
|
|
|
def do_change_status(self, request_dict, userID, response):
|
|
|
- did = request_dict.get('did', None)
|
|
|
+ uid = request_dict.get('uid', None)
|
|
|
status = request_dict.get('status', None)
|
|
|
channel = request_dict.get('channel', None)
|
|
|
- if not did or not status or not channel:
|
|
|
- return response.json(444, 'did,status,channel')
|
|
|
- dvqs = Device_Info.objects.filter(id=did, userID_id=userID, isShare=False).values("UID")
|
|
|
+ if not uid or not status or not channel:
|
|
|
+ return response.json(444, 'uid,status,channel')
|
|
|
+ dvqs = Device_Info.objects.filter(UID=uid, userID_id=userID, isShare=False)
|
|
|
if not dvqs.exists():
|
|
|
return response.json(12)
|
|
|
- UID = dvqs[0]["UID"]
|
|
|
- ubqs = UID_Bucket.objects.filter(channel=channel, uid=UID)
|
|
|
+ ubqs = UID_Bucket.objects.filter(channel=channel, uid=uid)
|
|
|
if not ubqs.exists():
|
|
|
return response.json(10, '未购买')
|
|
|
now_time = int(time.time())
|
|
@@ -711,7 +708,7 @@ class CloudVodView(View):
|
|
|
if status == 0:
|
|
|
return response.json(0)
|
|
|
utko = UidTokenObject()
|
|
|
- utko.generate(data={'uid': UID, 'channel': channel})
|
|
|
+ utko.generate(data={'uid': uid, 'channel': channel})
|
|
|
uidTkUrl = "{SERVER_DOMAIN}cloudVod/getSts?uidToken={uidToken}". \
|
|
|
format(uidToken=utko.token, SERVER_DOMAIN=SERVER_DOMAIN)
|
|
|
storeHlsUrl = "{SERVER_DOMAIN}cloudVod/storeplaylist?uidToken={uidToken}". \
|
|
@@ -750,17 +747,16 @@ class CloudVodView(View):
|
|
|
def do_filter_playlist(self, request_dict, userID, response):
|
|
|
startTime = int(request_dict.get('startTime', None))
|
|
|
endTime = int(request_dict.get('endTime', None))
|
|
|
- did = request_dict.get('did', None)
|
|
|
+ uid = request_dict.get('uid', None)
|
|
|
channel = request_dict.get('channel', None)
|
|
|
- dvqs = Device_Info.objects.filter(id=did, userID_id=userID, isShare=False).values("UID")
|
|
|
+ dvqs = Device_Info.objects.filter(UID=uid, userID_id=userID, isShare=False)
|
|
|
if not dvqs.exists():
|
|
|
return response.json(12)
|
|
|
- UID = dvqs[0]["UID"]
|
|
|
- ubqs = UID_Bucket.objects.filter(uid=UID, channel=channel).values('status')
|
|
|
+ ubqs = UID_Bucket.objects.filter(uid=uid, channel=channel).values('status')
|
|
|
if not ubqs.exists():
|
|
|
return response.json(10, '设备未购买')
|
|
|
nowTime = int(time.time())
|
|
|
- vodqs = VodHlsModel.objects.filter(uid=UID, channel=channel, time__range=(startTime, endTime),
|
|
|
+ vodqs = VodHlsModel.objects.filter(uid=uid, channel=channel, time__range=(startTime, endTime),
|
|
|
endTime__gte=nowTime) \
|
|
|
.values("time", "sec", "bucket__bucket", "bucket__endpoint", "bucket__region")
|
|
|
vod_play_list = []
|
|
@@ -771,9 +767,9 @@ class CloudVodView(View):
|
|
|
auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
|
|
|
bucket = oss2.Bucket(auth, endpoint, bucket_name)
|
|
|
m3u8 = '{uid}/vod{channel}/{time}/{time}.m3u8'. \
|
|
|
- format(uid=UID, channel=channel, time=vod['time'])
|
|
|
+ format(uid=uid, channel=channel, time=vod['time'])
|
|
|
ts = '{uid}/vod{channel}/{time}/ts0.ts'. \
|
|
|
- format(uid=UID, channel=channel, time=vod['time'])
|
|
|
+ format(uid=uid, channel=channel, time=vod['time'])
|
|
|
url = bucket.sign_url('GET', m3u8, 3600, params={'x-oss-process': 'hls/sign'})
|
|
|
urllst = url.split('?')
|
|
|
url_start = urllib.parse.unquote(urllst[0])
|