chenjunkai 6 years ago
parent
commit
154b3ed35b
1 changed files with 16 additions and 13 deletions
  1. 16 13
      Controller/CloudVod.py

+ 16 - 13
Controller/CloudVod.py

@@ -25,7 +25,7 @@ from django.utils.decorators import method_decorator
 from django.views.decorators.csrf import csrf_exempt
 from django.views.generic.base import View
 
-from Ansjer.config import OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, OSS_ROLE_ARN, SERVER_DOMAIN,PAYPAL_CRD
+from Ansjer.config import OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET, OSS_ROLE_ARN, SERVER_DOMAIN, PAYPAL_CRD
 from Model.models import Device_Info, Order_Model, Store_Meal, VodHlsModel, OssCrdModel, UID_Bucket
 from Object.ResponseObject import ResponseObject
 from Object.TokenObject import TokenObject
@@ -112,7 +112,7 @@ class CloudVodView(View):
             elif operation == 'details':
                 return self.do_get_details(request_dict, response)
             elif operation == 'queryVod':
-                return self.do_query_vod(request_dict,userID, response)
+                return self.do_query_vod(request_dict, userID, response)
             else:
                 return response.json(414)
 
@@ -212,9 +212,9 @@ class CloudVodView(View):
             values("bucket__storeDay", "bucket__region")
         if ubqs.exists():
             if ubqs[0]['bucket__region'] != smqs[0]['bucket__region']:
-                return response.json(712) # 区域不一致
+                return response.json(712)  # 区域不一致
             elif ubqs[0]['bucket__storeDay'] > smqs[0]['bucket__storeDay']:
-                return response.json(711) # 不可降级
+                return response.json(711)  # 不可降级
             # 续费流程
         nowTime = CommonService.get_utc()
         # 判断是否存在未完成订单
@@ -539,10 +539,14 @@ class CloudVodView(View):
             endpoint = vod["bucket__endpoint"]
             auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
             bucket = oss2.Bucket(auth, endpoint, bucket_name)
-            m3u8 = '{uid}/vod{channel}/{daytime}/{time}/{time}.m3u8'. \
-                format(uid=UID, channel=channel, daytime=daytime, time=vod['time'])
-            ts = '{uid}/vod{channel}/{daytime}/{time}/ts0.ts'. \
-                format(uid=UID, channel=channel, daytime=daytime, time=vod['time'])
+            # m3u8 = '{uid}/vod{channel}/{daytime}/{time}/{time}.m3u8'. \
+            #     format(uid=UID, channel=channel, daytime=daytime, time=vod['time'])
+            # ts = '{uid}/vod{channel}/{daytime}/{time}/ts0.ts'. \
+            #     format(uid=UID, channel=channel, daytime=daytime, time=vod['time'])
+            m3u8 = '{uid}/vod{channel}/{time}/{time}.m3u8'. \
+                format(uid=UID, channel=channel, time=vod['time'])
+            ts = '{uid}/vod{channel}/{time}/ts0.ts'. \
+                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])
@@ -578,11 +582,10 @@ class CloudVodView(View):
             endpoint = vod["bucket__endpoint"]
             auth = oss2.Auth(OSS_STS_ACCESS_KEY, OSS_STS_ACCESS_SECRET)
             bucket = oss2.Bucket(auth, endpoint, bucket_name)
-            daytime = time.strftime("%Y%m%d%H", time.localtime(vod['time']))
-            m3u8 = '{uid}/vod{channel}/{daytime}/{time}/{time}.m3u8'. \
-                format(uid=UID, channel=channel, daytime=daytime, time=vod['time'])
-            ts = '{uid}/vod{channel}/{daytime}/{time}/ts0.ts'. \
-                format(uid=UID, channel=channel, daytime=daytime, time=vod['time'])
+            m3u8 = '{uid}/vod{channel}/{time}/{time}.m3u8'. \
+                format(uid=UID, channel=channel, time=vod['time'])
+            ts = '{uid}/vod{channel}/{time}/ts0.ts'. \
+                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])