fix(计划): 构建计划时读取 ae_profile 全局切号参数
- 新增 account_folder.current_profile()(读库 + 合并默认值) - build_plan_job / ready_defaults 改用它,页面保存的切号选择器真正生效 - 手动按设备/账号跑也回落到 db 配置 - test_plan 增加 ae_profile 全局参数回归
This commit is contained in:
@@ -21,7 +21,7 @@ os.chdir(sys.path[0])
|
||||
|
||||
from flask import Flask # noqa: E402
|
||||
from core.models import (db, init_db, AeApp, CustomAction, TaskJob, # noqa: E402
|
||||
DeviceAccount, AePlan, AePlanRun)
|
||||
DeviceAccount, AePlan, AePlanRun, AeProfile)
|
||||
from core import account_folder as af # noqa: E402
|
||||
from core import device_pool, plan as plan_mod # noqa: E402
|
||||
|
||||
@@ -318,6 +318,31 @@ try:
|
||||
"name_selector_value": "//own"})["params"]
|
||||
check("显式 use_global=false 才用本计划覆盖",
|
||||
_own["name_selector_value"], "//own")
|
||||
# 真正的计划构建必须读 ae_profile(以前 build_plan_job 传的是 merged() 默认值,
|
||||
# 页面保存的全局切号参数根本不生效)
|
||||
with app.app_context():
|
||||
row = AeProfile.query.get("default")
|
||||
if row is None:
|
||||
row = AeProfile(id="default", name="测试配置", version=1)
|
||||
db.session.add(row)
|
||||
row.set_params({"fleet": {"switch": {
|
||||
"entry_selector_type": "xpath", "entry_selector_value": "//db-entry",
|
||||
"name_selector_type": "xpath", "name_selector_value": "//db-name",
|
||||
"me_selector_type": "xpath", "me_selector_value": "//db-me"}}})
|
||||
db.session.commit()
|
||||
rp3 = {"id": "p8", "name": "读全局切号", "app_id": "app1", "accounts": ["号甲"],
|
||||
"segments": [{"source": "action", "action_id": "act1", "app_id": "app1",
|
||||
"name": "发布", "publish": True, "per_account": 1}],
|
||||
"ready": {"enabled": True, "use_global": True}}
|
||||
rj3, rerr3 = plan_mod.build_plan_job(
|
||||
rp3, {"serial": "s", "device_name": "A07", "accounts": ["号甲"]})
|
||||
check("计划构建读 ae_profile 不报错", rerr3, "")
|
||||
_rd3 = [s for s in rj3.params["steps"][1]["params"]["children"]
|
||||
if s["type"] == "ensure_account"][0]["params"]
|
||||
check("计划构建用全局切号选择器",
|
||||
(_rd3["switch_selector_value"], _rd3["name_selector_value"],
|
||||
_rd3["me_selector_value"]),
|
||||
("//db-entry", "//db-name", "//db-me"))
|
||||
|
||||
# ==================== ③ 计划 CRUD ====================
|
||||
print("▶ ③ 计划保存 / 读 / 启停 / 删")
|
||||
|
||||
Reference in New Issue
Block a user