fix(计划): 通用步骤计划不再按待发素材数跳过账号

- foreach_account 新增 require_pending(默认 True,发布流程不变)
- build_segmented_steps 只要有段 publish=false 就设 False:
  每个号跑一遍 children,哪怕当天没有未发布素材
- 修复「检测账号」只执行亮屏的问题;补测试与文档
This commit is contained in:
2026-10-21 14:47:19 +08:00
parent a303855fee
commit 70959f5948
6 changed files with 70 additions and 8 deletions
+22
View File
@@ -169,6 +169,28 @@ w6 = gt.GenericStepsWorker("FAKE06", {})
w6._exec_foreach_account(None, {"children": []})
check('空 children 直接返回', w6._vars.get('target_name'), None)
print('=== 7. 只跑通用步骤(require_pending=False):没有待发素材也要跑 ===')
with app.app_context():
models.VideoPlan.query.delete()
models.db.session.commit()
w7 = gt.GenericStepsWorker("FAKE07", {}, ctx={"job_id": "t7"})
ran7 = []
w7._exec_steps = lambda d, s, depth=0: ran7.append(w7._vars.get('target_name'))
w7._exec_foreach_account(None, {"children": [{"type": "x"}],
"accounts": ["号甲", "号乙"],
"require_pending": False,
"date_source": "today"})
check('两个号都执行了(尽管没有任何待发素材)', ran7, ['号甲', '号乙'])
print('=== 8. 发布流程(默认 require_pending)没有待发素材 → 仍然不跑 ===')
w8 = gt.GenericStepsWorker("FAKE08", {}, ctx={"job_id": "t8"})
ran8 = []
w8._exec_steps = lambda d, s, depth=0: ran8.append(w8._vars.get('target_name'))
w8._exec_foreach_account(None, {"children": [{"type": "x"}],
"accounts": ["号甲", "号乙"],
"date_source": "today"})
check('没有待发素材 → 不执行', ran8, [])
print()
shutil.rmtree(TMP, ignore_errors=True)
if fails: