chanjunkai 5 лет назад
Родитель
Сommit
56422c7874
1 измененных файлов с 29 добавлено и 2 удалено
  1. 29 2
      Controller/CloudStorage.py

+ 29 - 2
Controller/CloudStorage.py

@@ -69,6 +69,8 @@ class CloudStorageView(View):
         response = ResponseObject()
         if operation is None:
             return response.json(444, 'error path')
+        elif operation == 'testpalym3u8':
+            return self.do_test_play_m3u8(request_dict, response)
         elif operation == 'dopaypalcallback':
             return self.do_pay_by_paypal_callback(request_dict, response)
         elif operation == 'doalicallback':
@@ -98,9 +100,34 @@ class CloudStorageView(View):
                 return self.do_query_vod_list(request_dict, userID, response)
             elif operation == 'commoditylist':
                 return self.do_commodity_list(request_dict, userID, response)
+            elif operation == 'queryorder':
+                return self.do_query_order(request_dict, userID, response)
             else:
                 return response.json(414)
 
+    def do_test_play_m3u8(self, request_dict, response):
+        playlist_entries = [
+            {
+                'name': 'https://azvod1.s3-ap-northeast-1.amazonaws.com/test/output000.ts',
+                'duration': 10,
+            },
+            {
+                'name': 'https://azvod1.s3-ap-northeast-1.amazonaws.com/test/output000.ts',
+                'duration': 10,
+            },
+            {
+                'name': 'https://azvod1.s3-ap-northeast-1.amazonaws.com/test/output000.ts',
+                'duration': 10,
+            },
+        ]
+        playlist = PlaylistGenerator(playlist_entries).generate()
+        response = HttpResponse(playlist, content_type="application/octet-stream")
+        return response
+
+    def do_query_order(self, request_dict, userID, response):
+
+        return
+
     def do_commodity_list(self, request_dict, userID, response):
         mold = request_dict.get('mold', None)
         qs = Store_Meal.objects
@@ -109,9 +136,9 @@ class CloudStorageView(View):
         else:
             qs = qs.filter(bucket__mold=0)
         qs = qs.values("id", "title", "content", "price",
-                       "day", "currency","bucket__storeDay",
+                       "day", "currency", "bucket__storeDay",
                        "bucket__bucket", "bucket__area", "type",
-                       "commodity_code","commodity_type")
+                       "commodity_code", "commodity_type")
         if qs.exists():
             ql = list(qs)
             from operator import itemgetter