|
@@ -38,6 +38,8 @@ from Service.CommonService import CommonService
|
|
|
# 获取设备推送hls流 证书
|
|
|
http://192.168.136.40:8077/cloudVod/getSts?uidToken=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1aWQiOiJGVFNMTDhITTQzN1ozOFdVMTExQSJ9.GIBt8SgY-3yRt9mlihtvRwLM-MT8uVPDKCUQ2yvV3Vo
|
|
|
# 获取存储的播放文件列表
|
|
|
+#修改状态
|
|
|
+http://192.168.136.40:8077/cloudVod/status?token=local&did=138001380001543918745881545&channel=4&status=1
|
|
|
'''
|
|
|
|
|
|
|
|
@@ -65,6 +67,7 @@ class CloudVodView(View):
|
|
|
# 移动侦测获取设备sts证书
|
|
|
ip = CommonService.get_ip_address(request)
|
|
|
return self.do_getSts(request_dict, ip, response)
|
|
|
+ # 付款完成
|
|
|
elif operation == 'payExecute':
|
|
|
return self.do_paypal_execute(request_dict, response)
|
|
|
else:
|
|
@@ -82,9 +85,20 @@ class CloudVodView(View):
|
|
|
return self.do_create_order(request_dict, userID, response)
|
|
|
elif operation == 'status':
|
|
|
return self.do_change_status(request_dict, userID, response)
|
|
|
+ elif operation == 'details':
|
|
|
+ return self.do_meal_details(request_dict, userID, response)
|
|
|
else:
|
|
|
return response.json(414)
|
|
|
|
|
|
+ def do_meal_details(self, request_dict, userID, response):
|
|
|
+ did = request_dict.get('did', None)
|
|
|
+ qs = Device_Info.objects.filter(userID_id=userID, id=did).values("UID")
|
|
|
+ UID = qs[0]["UID"]
|
|
|
+ dmqs = Device_Meal.objects.filter(uid=UID).values('rank', 'status', 'channel', 'add_time', 'update_time',
|
|
|
+ 'end_time', 'rank__title')
|
|
|
+ res = CommonService.qs_to_list(dmqs)
|
|
|
+ return response.json(0, res)
|
|
|
+
|
|
|
def do_create_order(self, request_dict, userID, response):
|
|
|
did = request_dict.get('did', None)
|
|
|
rank = request_dict.get('rank', None)
|
|
@@ -97,7 +111,7 @@ class CloudVodView(View):
|
|
|
uid = qs[0]['UID']
|
|
|
nowTime = int(time.time())
|
|
|
orderID = CommonService.createID()
|
|
|
- smqs = Store_Meal.objects.filter(id=rank).values("currency","price")
|
|
|
+ smqs = Store_Meal.objects.filter(id=rank).values("currency", "price")
|
|
|
currency = smqs[0]['currency']
|
|
|
price = smqs[0]['price']
|
|
|
# call_sub_url = "{SERVER_DOMAIN}cloudVod/payExecute?orderID={orderID}".format(SERVER_DOMAIN=SERVER_DOMAIN,orderID=orderID)
|
|
@@ -157,12 +171,14 @@ class CloudVodView(View):
|
|
|
if utko.flag is False:
|
|
|
return response.json(444, 'uidToken')
|
|
|
UID = utko.UID
|
|
|
- qs = Device_Meal.objects.filter(uid=UID, status=1).values("rank", "channel")
|
|
|
+ channel = utko.channel
|
|
|
+ print(channel)
|
|
|
+ print(UID)
|
|
|
+ qs = Device_Meal.objects.filter(uid=UID, channel=channel, status=1).values("rank", "channel")
|
|
|
if not qs.exists():
|
|
|
return response.json(10, '设备未购买')
|
|
|
# 套餐id
|
|
|
rank = qs[0]['rank']
|
|
|
- channel = qs[0]['channel']
|
|
|
storage = '{uid}/vod{channel}/'.format(uid=UID, channel=channel)
|
|
|
|
|
|
# bucket_vod_list = {1: 'cloudvod1', 2: 'cloudvod2', 3: 'cloudvod3'}
|
|
@@ -256,7 +272,8 @@ class CloudVodView(View):
|
|
|
if obj.is_prefix(): # 文件夹
|
|
|
print('directory: ' + obj.key)
|
|
|
ptime = obj.key.split('/')[3]
|
|
|
- url = bucket.sign_url('GET', '{prefix}{name}.m3u8'.format(prefix=obj.key, name=ptime), 60 * 60,params={'x-oss-process': 'hls/sign'})
|
|
|
+ url = bucket.sign_url('GET', '{prefix}{name}.m3u8'.format(prefix=obj.key, name=ptime), 60 * 60,
|
|
|
+ params={'x-oss-process': 'hls/sign'})
|
|
|
# url = bucket.sign_url('GET', obj.key, 60 * 60,params={'x-oss-process': 'hls/sign'})
|
|
|
urllst = url.split('?')
|
|
|
url_start = urllib.parse.unquote(urllst[0])
|
|
@@ -324,11 +341,14 @@ class CloudVodView(View):
|
|
|
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).values("UID")
|
|
|
+ UID = dvqs[0]["UID"]
|
|
|
if not dvqs.exists():
|
|
|
return response.json(10, '没有设备')
|
|
|
- dmqs = Device_Meal.objects.filter(channel=channel, uid=dvqs[0]["UID"])
|
|
|
+ dmqs = Device_Meal.objects.filter(channel=channel, uid=UID)
|
|
|
if not dmqs.exists():
|
|
|
return response.json(10, '未购买')
|
|
|
now_time = timezone.localtime(timezone.now())
|
|
|
dmqs.update(update_time=now_time, status=status)
|
|
|
- return response.json(0)
|
|
|
+ utko = UidTokenObject()
|
|
|
+ utko.generate(data={'uid': UID, 'channel': channel})
|
|
|
+ return response.json(0,utko.token)
|