소스 검색

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