From 81b71d023d6ee602c842d7a49696572f29f7c8d4 Mon Sep 17 00:00:00 2001 From: Deroino <117969239+Deroino@users.noreply.github.com> Date: Thu, 13 Nov 2025 09:12:39 +0800 Subject: [PATCH] feat(wechat-channel): add draft upload functionality for video channel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add isDraft parameter to TencentVideo class to control publishing behavior - Modify click_publish method to click "保存草稿" instead of "发表" when isDraft is true - Update post_video_tencent function to accept and pass is_draft parameter - Add is_draft parameter to /postVideo API endpoint to receive frontend data - Add "视频号上传草稿" checkbox in frontend that appears only for video channel platform - Update defaultTabInit to include isDraft property with default value false - Include isDraft in publishData sent to backend API - Implement proper URL checking for draft vs publish success confirmation The new functionality allows users to save WeChat Channel videos as drafts instead of immediately publishing them when the checkbox is selected. --- myUtils/postVideo.py | 4 +-- sau_backend.py | 3 +- sau_frontend/src/views/PublishCenter.vue | 15 +++++++-- uploader/tencent_uploader/main.py | 41 +++++++++++++++++------- 4 files changed, 46 insertions(+), 17 deletions(-) diff --git a/myUtils/postVideo.py b/myUtils/postVideo.py index e33f3d0..bd94e0b 100644 --- a/myUtils/postVideo.py +++ b/myUtils/postVideo.py @@ -10,7 +10,7 @@ from utils.constant import TencentZoneTypes from utils.files_times import generate_schedule_time_next_day -def post_video_tencent(title,files,tags,account_file,category=TencentZoneTypes.LIFESTYLE.value,enableTimer=False,videos_per_day = 1, daily_times=None,start_days = 0): +def post_video_tencent(title,files,tags,account_file,category=TencentZoneTypes.LIFESTYLE.value,enableTimer=False,videos_per_day = 1, daily_times=None,start_days = 0, is_draft=False): # 生成文件的完整路径 account_file = [Path(BASE_DIR / "cookiesFile" / file) for file in account_file] files = [Path(BASE_DIR / "videoFile" / file) for file in files] @@ -25,7 +25,7 @@ def post_video_tencent(title,files,tags,account_file,category=TencentZoneTypes.L print(f"视频文件名:{file}") print(f"标题:{title}") print(f"Hashtag:{tags}") - app = TencentVideo(title, str(file), tags, publish_datetimes[index], cookie, category) + app = TencentVideo(title, str(file), tags, publish_datetimes[index], cookie, category, is_draft) asyncio.run(app.main(), debug=False) diff --git a/sau_backend.py b/sau_backend.py index ad82425..480bbfc 100644 --- a/sau_backend.py +++ b/sau_backend.py @@ -363,6 +363,7 @@ def postVideo(): productLink = data.get('productLink', '') productTitle = data.get('productTitle', '') thumbnail_path = data.get('thumbnail', '') + is_draft = data.get('isDraft', False) # 新增参数:是否保存为草稿 videos_per_day = data.get('videosPerDay') daily_times = data.get('dailyTimes') @@ -376,7 +377,7 @@ def postVideo(): start_days) case 2: post_video_tencent(title, file_list, tags, account_list, category, enableTimer, videos_per_day, daily_times, - start_days) + start_days, is_draft) case 3: post_video_DouYin(title, file_list, tags, account_list, category, enableTimer, videos_per_day, daily_times, start_days, thumbnail_path, productLink, productTitle) diff --git a/sau_frontend/src/views/PublishCenter.vue b/sau_frontend/src/views/PublishCenter.vue index 61d5cd1..f7824ca 100644 --- a/sau_frontend/src/views/PublishCenter.vue +++ b/sau_frontend/src/views/PublishCenter.vue @@ -402,6 +402,15 @@ /> + +