|
@@ -6,6 +6,7 @@ import time
|
|
from uuid import uuid4
|
|
from uuid import uuid4
|
|
|
|
|
|
from applications.functions.log import logging
|
|
from applications.functions.log import logging
|
|
|
|
+from applications.functions.forward import forward_requests
|
|
from static.config import db_article
|
|
from static.config import db_article
|
|
|
|
|
|
|
|
|
|
@@ -13,6 +14,7 @@ class Record(object):
|
|
"""
|
|
"""
|
|
搜索接口处理逻辑
|
|
搜索接口处理逻辑
|
|
"""
|
|
"""
|
|
|
|
+ NEW_STRATEGY = "strategy_v2"
|
|
|
|
|
|
def __init__(self, params, mysql_client):
|
|
def __init__(self, params, mysql_client):
|
|
self.content_id = None
|
|
self.content_id = None
|
|
@@ -20,6 +22,7 @@ class Record(object):
|
|
self.contents = None
|
|
self.contents = None
|
|
self.title = None
|
|
self.title = None
|
|
self.gh_id = None
|
|
self.gh_id = None
|
|
|
|
+ self.strategy = None
|
|
self.params = params
|
|
self.params = params
|
|
self.mysql_client = mysql_client
|
|
self.mysql_client = mysql_client
|
|
self.trace_id = "search-{}-{}".format(str(uuid4()), str(int(time.time())))
|
|
self.trace_id = "search-{}-{}".format(str(uuid4()), str(int(time.time())))
|
|
@@ -35,6 +38,7 @@ class Record(object):
|
|
self.contents = self.params['content'].replace("'", "")
|
|
self.contents = self.params['content'].replace("'", "")
|
|
self.account_name = self.params['accountName'].replace("'", "")
|
|
self.account_name = self.params['accountName'].replace("'", "")
|
|
self.content_id = self.params['articleId']
|
|
self.content_id = self.params['articleId']
|
|
|
|
+ self.strategy = self.params['strategy']
|
|
logging(
|
|
logging(
|
|
code="1001",
|
|
code="1001",
|
|
info="搜索视频内容接口请求成功, 参数校验成功",
|
|
info="搜索视频内容接口请求成功, 参数校验成功",
|
|
@@ -90,6 +94,12 @@ class Record(object):
|
|
return params_error
|
|
return params_error
|
|
else:
|
|
else:
|
|
# 记录
|
|
# 记录
|
|
|
|
+ if self.strategy == self.NEW_STRATEGY:
|
|
|
|
+ response = await forward_requests(
|
|
|
|
+ params=self.params,
|
|
|
|
+ api="search_videos"
|
|
|
|
+ )
|
|
|
|
+ return response
|
|
await self.input_queue()
|
|
await self.input_queue()
|
|
res = {
|
|
res = {
|
|
"status": "success input to article queue",
|
|
"status": "success input to article queue",
|