|
@@ -14,6 +14,7 @@ from application.common.feishu.feishu_utils import FeishuUtils
|
|
from application.common.gpt import GPT4oMini
|
|
from application.common.gpt import GPT4oMini
|
|
from application.common.mysql.sql import Sql
|
|
from application.common.mysql.sql import Sql
|
|
from application.common.redis.xng_redis import xng_in_video_data
|
|
from application.common.redis.xng_redis import xng_in_video_data
|
|
|
|
+from application.config.config import zhufuquanzi_view_api
|
|
|
|
|
|
sys.path.append(os.getcwd())
|
|
sys.path.append(os.getcwd())
|
|
|
|
|
|
@@ -24,6 +25,40 @@ from application.common.log import AliyunLogger
|
|
from application.common.mysql import MysqlHelper
|
|
from application.common.mysql import MysqlHelper
|
|
|
|
|
|
|
|
|
|
|
|
+def video_view(content_id, account_id):
|
|
|
|
+ headers = {
|
|
|
|
+ "Content-Type": "application/json"
|
|
|
|
+ }
|
|
|
|
+ payload = {
|
|
|
|
+ "content_id": content_id,
|
|
|
|
+ "account_id": account_id
|
|
|
|
+ }
|
|
|
|
+ try:
|
|
|
|
+ # 发送 POST 请求
|
|
|
|
+ response = requests.post(
|
|
|
|
+ zhufuquanzi_view_api,
|
|
|
|
+ headers=headers,
|
|
|
|
+ json=payload # 自动将字典转换为 JSON
|
|
|
|
+ )
|
|
|
|
+ # 检查 HTTP 状态码
|
|
|
|
+ if response.status_code == 200:
|
|
|
|
+ # 解析 JSON 响应
|
|
|
|
+ result = response.json()
|
|
|
|
+ # 提取关键字段
|
|
|
|
+ code = result.get("code")
|
|
|
|
+ msg = result.get("msg")
|
|
|
|
+ # 业务逻辑处理(示例)
|
|
|
|
+ if code == 0:
|
|
|
|
+ print("请求成功")
|
|
|
|
+ else:
|
|
|
|
+ print(f"请求失败,错误码: {code}, 消息: {msg}")
|
|
|
|
+ else:
|
|
|
|
+ print(f"HTTP 请求失败,状态码: {response.status_code}")
|
|
|
|
+ except requests.exceptions.RequestException as e:
|
|
|
|
+ print(f"请求异常: {e}")
|
|
|
|
+ except json.JSONDecodeError:
|
|
|
|
+ print("响应不是有效的 JSON 格式")
|
|
|
|
+
|
|
|
|
|
|
class ZFQZTJLRecommend(object):
|
|
class ZFQZTJLRecommend(object):
|
|
"""
|
|
"""
|
|
@@ -173,14 +208,13 @@ class ZFQZTJLRecommend(object):
|
|
self.download_cnt += 1
|
|
self.download_cnt += 1
|
|
self.mq.send_msg(mq_obj)
|
|
self.mq.send_msg(mq_obj)
|
|
self.aliyun_log.logging(code="1002", message="成功发送至 ETL", data=mq_obj)
|
|
self.aliyun_log.logging(code="1002", message="成功发送至 ETL", data=mq_obj)
|
|
|
|
+ video_view(video_obj["id"], video_obj['user']['mid'])
|
|
|
|
+ self.aliyun_log.logging(code="1010", message="触发曝光", data=mq_obj)
|
|
if self.download_cnt >= int(
|
|
if self.download_cnt >= int(
|
|
self.rule_dict.get("videos_cnt", {}).get("min", 200)
|
|
self.rule_dict.get("videos_cnt", {}).get("min", 200)
|
|
):
|
|
):
|
|
self.limit_flag = True
|
|
self.limit_flag = True
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
def run(self):
|
|
def run(self):
|
|
self.get_recommend_list()
|
|
self.get_recommend_list()
|
|
|
|
|