|
@@ -12,8 +12,9 @@ import urllib.parse
|
|
|
from config import source_id_db
|
|
|
|
|
|
|
|
|
-def createPath(video_id, shared_uid, gh_id, business_type, index):
|
|
|
+def createPath(video_id, shared_uid, gh_id, business_type, publish_type, index):
|
|
|
"""
|
|
|
+ :param publish_type: 发布类型
|
|
|
:param index: 视频位置信息
|
|
|
:param business_type: 业务类型
|
|
|
:param gh_id: 公众号账号的gh_id
|
|
@@ -35,17 +36,17 @@ def createPath(video_id, shared_uid, gh_id, business_type, index):
|
|
|
case 1:
|
|
|
# 公众号投流
|
|
|
source_id = "GzhTouLiu_Articles_{}_".format(gh_id) + generate_source_id()
|
|
|
- url = f"pages/user-videos?id={video_id}&su={shared_uid}&fromGzh=1&index={index}&rootSourceId={source_id}"
|
|
|
+ url = f"pages/user-videos?id={video_id}&su={shared_uid}&fromGzh=1&index={index}&publishType={publish_type}&rootSourceId={source_id}"
|
|
|
return source_id, f"pages/category?jumpPage={urllib.parse.quote(url, safe='')}"
|
|
|
case 2:
|
|
|
# 小程序投流
|
|
|
source_id = "GzhTouLiu_Minigram_{}_".format(gh_id) + generate_source_id()
|
|
|
- url = f"pages/user-videos?id={video_id}&su={shared_uid}&fromGzh=1&index={index}&rootSourceId={source_id}"
|
|
|
+ url = f"pages/user-videos?id={video_id}&su={shared_uid}&fromGzh=1&index={index}&publishType={publish_type}&rootSourceId={source_id}"
|
|
|
return source_id, f"pages/category?jumpPage={urllib.parse.quote(url, safe='')}"
|
|
|
case 3:
|
|
|
- # 小程序投流
|
|
|
+ # 企微
|
|
|
source_id = "GzhTouLiu_Wecom_{}_".format(gh_id) + generate_source_id()
|
|
|
- url = f"pages/user-videos?id={video_id}&su={shared_uid}&fromGzh=1&index={index}&rootSourceId={source_id}"
|
|
|
+ url = f"pages/user-videos?id={video_id}&su={shared_uid}&fromGzh=1&index={index}&publishType={publish_type}&rootSourceId={source_id}"
|
|
|
return source_id, f"pages/category?jumpPage={urllib.parse.quote(url, safe='')}"
|
|
|
|
|
|
return None, None
|
|
@@ -73,6 +74,7 @@ async def saveSourceToDB(db_client, params, request_id):
|
|
|
article_title = params['articleTitle']
|
|
|
# 业务信息
|
|
|
business_type = params['businessType']
|
|
|
+ publish_type = params['publishType']
|
|
|
position = params['position']
|
|
|
cooperation = params['cooperation']
|
|
|
|
|
@@ -85,7 +87,7 @@ async def saveSourceToDB(db_client, params, request_id):
|
|
|
return response
|
|
|
|
|
|
# source_id, gzh_path
|
|
|
- source_id, share_path = createPath(video_id, uid, gh_id, business_type, position)
|
|
|
+ source_id, share_path = createPath(video_id, uid, gh_id, business_type, publish_type, position)
|
|
|
|
|
|
# minigram_info
|
|
|
minigram_name = "祝福岁岁平安"
|
|
@@ -93,9 +95,9 @@ async def saveSourceToDB(db_client, params, request_id):
|
|
|
|
|
|
sql = f"""
|
|
|
INSERT INTO {source_id_db}
|
|
|
- (video_id, video_cover, video_title, uid, gh_id, account_name, article_title, business_type, cooperation, position, source_id, share_path, create_time, minigram_name, minigram_id)
|
|
|
+ (video_id, video_cover, video_title, uid, gh_id, account_name, article_title, business_type, publish_type, cooperation, position, source_id, share_path, create_time, minigram_name, minigram_id)
|
|
|
values
|
|
|
- (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);
|
|
|
+ (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s);
|
|
|
"""
|
|
|
try:
|
|
|
await db_client.asyncInsert(
|
|
@@ -109,6 +111,7 @@ async def saveSourceToDB(db_client, params, request_id):
|
|
|
account_name,
|
|
|
article_title,
|
|
|
business_type,
|
|
|
+ publish_type,
|
|
|
cooperation,
|
|
|
position,
|
|
|
source_id,
|