T-580 精简设置页更新执行配置

This commit is contained in:
chengma
2026-07-10 10:12:15 +08:00
parent c078e68e98
commit e70e831afa
12 changed files with 259 additions and 287 deletions
+8 -37
View File
@@ -259,11 +259,6 @@ class ApplyTab(QWidget):
self._set_status(content_error.replace("\n", " "))
return
dry_run = bool(dry_run)
safety_error = self._update_safety_error(tasks, dry_run=dry_run)
if safety_error:
self._show_update_safety_error(safety_error)
self._set_status(safety_error.replace("\n", " "))
return
answer = QMessageBox.question(
self,
"确认检查本轮更新" if dry_run else "确认开始更新",
@@ -279,10 +274,8 @@ class ApplyTab(QWidget):
tasks,
db_path=self.db_path,
config=self.config,
close_success_tab=bool(update_cfg.get("close_success_tab", False)),
dry_run=dry_run,
update_mode=update_mode,
parallel_accounts=bool(update_cfg.get("parallel_accounts", False)),
max_parallel_accounts=max(
1,
int(update_cfg.get("max_parallel_accounts", 1) or 1),
@@ -492,12 +485,15 @@ class ApplyTab(QWidget):
update_mode = self._current_update_mode()
update_mode_text = self._update_mode_label(update_mode)
cover_warning = "\n本轮将更新线上封面,请确认封面内容无误。" if appconfig.update_mode_includes_cover(update_mode) else ""
close_text = "是" if update_cfg.get("close_success_tab") else "否"
batch_size = max(1, int(update_cfg.get("max_items_per_run", 1) or 1))
batch_count = (len(tasks) + batch_size - 1) // batch_size if tasks else 0
max_parallel_accounts = max(
1,
int(update_cfg.get("max_parallel_accounts", 1) or 1),
)
parallel_text = (
f"开启,最多 {update_cfg.get('max_parallel_accounts', 1)} 个账号"
if update_cfg.get("parallel_accounts")
f"最多 {max_parallel_accounts} 个账号"
if max_parallel_accounts > 1
else "关闭"
)
intro = (
@@ -514,9 +510,9 @@ class ApplyTab(QWidget):
+ f"更新内容:{update_mode_text}\n"
+ f"任务数:{len(tasks)}\n"
+ f"预计批次:{batch_count}\n\n"
+ "安全设置:"
+ "执行设置:"
+ f"每批最大更新条数={batch_size},"
+ f"成功后关闭新页={close_text},"
+ "成功后自动关闭程序新开编辑页,"
+ f"多账号并行={parallel_text}\n\n"
+ cover_warning
+ ("\n\n" if cover_warning else "")
@@ -527,30 +523,6 @@ class ApplyTab(QWidget):
)
)
def _update_safety_error(self, tasks, dry_run=False):
update_cfg = self._shopee_update_config()
if dry_run:
return None
if not update_cfg.get("allow_real_submit", False):
return (
"设置未开启「允许真实提交线上商品」,已阻止本次更新。\n"
"请到⑤设置 > 蝦皮更新安全开启该开关后再开始更新。"
)
return None
def _show_update_safety_error(self, message):
box = QMessageBox(self)
box.setIcon(QMessageBox.Warning)
box.setWindowTitle("更新安全开关")
box.setText(str(message))
settings_button = None
if self.open_settings_callback is not None:
settings_button = box.addButton("前往设置", QMessageBox.ActionRole)
box.addButton(QMessageBox.Ok)
box.exec()
if settings_button is not None and box.clickedButton() is settings_button:
self.open_settings_callback()
def _shopee_update_config(self):
return appconfig.shopee_update_config(self.config)
@@ -584,7 +556,6 @@ class ApplyTab(QWidget):
update_mode = self._current_update_mode()
update_cfg = self._shopee_update_config()
update_cfg["update_mode"] = update_mode
update_cfg["allow_cover_update"] = appconfig.update_mode_includes_cover(update_mode)
payload = {
key: value
for key, value in self.config.items()