浏览代码

Merge branch '2024_09_27_forward_by_strategy' of Server/title_with_video into master

luojunhui 6 月之前
父节点
当前提交
bf443e3635
共有 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",