|
@@ -12,14 +12,16 @@ import urllib.parse
|
|
|
from applications.functions.log import logging
|
|
|
from static.config import db_article
|
|
|
from applications.functions.common import request_for_info
|
|
|
+from applications.functions.forward import forward_requests
|
|
|
|
|
|
|
|
|
class Response(object):
|
|
|
"""
|
|
|
召回逻辑
|
|
|
"""
|
|
|
+ NEW_STRATEGY = "strategy_v2"
|
|
|
|
|
|
- def __init__(self, trace_id, mysql_client, mini_program_type):
|
|
|
+ def __init__(self, trace_id, mysql_client, mini_program_type, strategy="strategy_v1"):
|
|
|
"""
|
|
|
长文: 25, 29, 31
|
|
|
投流: 33
|
|
@@ -31,6 +33,7 @@ class Response(object):
|
|
|
self.trace_id = trace_id
|
|
|
self.mysql_client = mysql_client
|
|
|
self.mini_program_type = mini_program_type
|
|
|
+ self.strategy = strategy
|
|
|
self.mini_map = {
|
|
|
# 25: {
|
|
|
# "avatar": "https://rescdn.yishihui.com/0temp/ttmhzfsh.png",
|
|
@@ -285,6 +288,16 @@ class Response(object):
|
|
|
Recall Deal
|
|
|
:return:
|
|
|
"""
|
|
|
+ if self.strategy == self.NEW_STRATEGY:
|
|
|
+ response = await forward_requests(
|
|
|
+ params={
|
|
|
+ "traceId": self.trace_id,
|
|
|
+ "miniprogramUseType": self.mini_program_type,
|
|
|
+ "strategy": self.strategy
|
|
|
+ },
|
|
|
+ api="recall_videos"
|
|
|
+ )
|
|
|
+ return response
|
|
|
response = await self.get_result()
|
|
|
status_code = response.get("content_status")
|
|
|
process_times = response.get("process_times")
|