fix: TikTok 日上传配额按官方 Direct Post 约 15 条/账号

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
eric 2026-08-14 21:57:10 -05:00
parent f76c5a326f
commit 952e90cc54
2 changed files with 14 additions and 7 deletions

View File

@ -15,7 +15,10 @@ _lock = threading.RLock()
# Each Shorts channel is forced to exactly this many slots per Beijing day. # Each Shorts channel is forced to exactly this many slots per Beijing day.
SHORTS_DAILY_FORCE = 9 SHORTS_DAILY_FORCE = 9
TIKTOK_DAILY_FORCE = 9 # TikTok official Content Posting / Direct Post guideline:
# "typically around 15 posts per day / creator account"
# https://developers.tiktok.com/doc/content-sharing-guidelines
TIKTOK_DAILY_FORCE = 15
def _force_daily_quota(value: Any = None) -> int: def _force_daily_quota(value: Any = None) -> int:
@ -302,6 +305,10 @@ def init_db() -> None:
"UPDATE shorts_channels SET daily_min = ?, daily_max = ?", "UPDATE shorts_channels SET daily_min = ?, daily_max = ?",
(SHORTS_DAILY_FORCE, SHORTS_DAILY_FORCE), (SHORTS_DAILY_FORCE, SHORTS_DAILY_FORCE),
) )
conn.execute(
"UPDATE tiktok_channels SET daily_min = ?, daily_max = ?",
(TIKTOK_DAILY_FORCE, TIKTOK_DAILY_FORCE),
)
conn.commit() conn.commit()
except Exception: except Exception:
pass pass

View File

@ -462,9 +462,9 @@ export default function TikTokPage() {
scheduled: 0, scheduled: 0,
uploaded: 0, uploaded: 0,
pending: 0, pending: 0,
gap: 9, gap: 15,
max_met: false, max_met: false,
daily_max: 9, daily_max: 15,
})); }));
const seen = new Set(fromBoard.map((c) => c.id)); const seen = new Set(fromBoard.map((c) => c.id));
const extra = channels const extra = channels
@ -479,9 +479,9 @@ export default function TikTokPage() {
scheduled: 0, scheduled: 0,
uploaded: 0, uploaded: 0,
pending: 0, pending: 0,
gap: 9, gap: 15,
max_met: false, max_met: false,
daily_max: 9, daily_max: 15,
})); }));
return [...fromBoard, ...extra]; return [...fromBoard, ...extra];
})(); })();
@ -995,12 +995,12 @@ export default function TikTokPage() {
<section ref={leftPanelRef} className="rounded-2xl border border-white/10 bg-black/25 p-4"> <section ref={leftPanelRef} className="rounded-2xl border border-white/10 bg-black/25 p-4">
<div className="mb-3 flex items-center justify-between"> <div className="mb-3 flex items-center justify-between">
<h3 className="text-sm font-medium text-slate-100">账号配额({channels.length})</h3> <h3 className="text-sm font-medium text-slate-100">账号配额({channels.length})</h3>
<span className="text-[11px] text-slate-500">北京日 {beijingWindow || "—"} · 每账号 9 条/日</span> <span className="text-[11px] text-slate-500">北京日 {beijingWindow || "—"} · 每账号 15 条/日(官方 Direct Post 约数)</span>
</div> </div>
<div className="grid gap-3 sm:grid-cols-2"> <div className="grid gap-3 sm:grid-cols-2">
{displayChannels.map((ch) => { {displayChannels.map((ch) => {
const full = channels.find((x) => x.id === ch.id); const full = channels.find((x) => x.id === ch.id);
const pct = Math.min(100, Math.round(((ch.used || 0) / Math.max(1, ch.daily_max || 9)) * 100)); const pct = Math.min(100, Math.round(((ch.used || 0) / Math.max(1, ch.daily_max || 15)) * 100));
return ( return (
<div <div
key={ch.id} key={ch.id}