123456789101112131415161718192021222324252627282930313233 |
- import os
- import sys
- from datetime import datetime, timedelta
- sys.path.append(os.getcwd())
- from common import MysqlHelper
- class sqlCollect():
- """
- 视频信息写入库中
- """
- @classmethod
- def update_task_tencent_material(cls, video_id, oss_object_key):
- current_time = datetime.now()
- formatted_time = current_time.strftime("%Y-%m-%d %H:%M:%S")
- insert_sql = f"""UPDATE ad_put_tencent_material_upload_handle SET video_after_path = '{oss_object_key}', processe_node = 1, update_time = '{formatted_time}' WHERE video_id = {video_id};"""
- data = MysqlHelper.update_values(
- sql=insert_sql
- )
- """
- 判断该任务id是否用过
- """
- @classmethod
- def is_video_id(cls):
- current_time = datetime.now()
- formatted_time = current_time.strftime("%Y-%m-%d")
- sql = f"""SELECT video_id FROM ad_put_tencent_material_upload_handle WHERE processe_node = '0' AND update_time LIKE '{formatted_time}%' AND is_delete = 0;"""
- data = MysqlHelper.get_values(sql)
- return data
|