فهرست منبع

get_off_videos兼容

罗俊辉 6 ماه پیش
والد
کامیت
6ea378d21a
1فایلهای تغییر یافته به همراه12 افزوده شده و 0 حذف شده
  1. 12 0
      applications/deal/getOffVideos.py

+ 12 - 0
applications/deal/getOffVideos.py

@@ -4,14 +4,17 @@
 import time
 
 from static.config import db_article
+from applications.functions.forward import forward_requests
 
 
 class GetOffVideos(object):
     """
     下架视频
     """
+    NEW_STRATEGY = "strategy_v2"
 
     def __init__(self, params, mysql_client):
+        self.strategy = None
         self.params = params
         self.mysql_client = mysql_client
         self.trace_id = None
@@ -23,6 +26,9 @@ class GetOffVideos(object):
         """
         try:
             self.trace_id = self.params['traceId']
+            self.strategy = self.params.get('strategy')
+            if not self.strategy:
+                self.strategy = "strategy_v1"
             return None
         except Exception as e:
             response = {
@@ -67,6 +73,12 @@ class GetOffVideos(object):
         if params_error:
             return params_error
         else:
+            if self.strategy == self.NEW_STRATEGY:
+                response = await forward_requests(
+                    params=self.params,
+                    api="get_off_videos"
+                )
+                return response
             await self.pushVideoIntoQueue()
             response = {
                 "status": "success",