feat: 抽取 Shopee 编辑器模块

新增 app/editor.py,封装商品页打开、登录检测、标题读取写入、封面读取下载、封面上传拖拽、更新按钮点击和 apply_task。

扩展 app/cdp.py 的 host 参数,支持后续按账号端口连接 CDP。

同步任务看板、模块合约、当前状态和进度记录,标记 T-001 完成;记录测试商品标题读写、封面读取与 1_TY030.jpg 上传拖拽验证结果。
This commit is contained in:
chengma
2026-06-26 18:02:57 +08:00
parent ef389b323f
commit 26dac2a718
6 changed files with 457 additions and 18 deletions
+3 -3
View File
@@ -112,11 +112,11 @@ create_shortcut(account, dest_dir=None) -> str # 可选 .lnk,PowerShell WScr
```python
CDP_HOST: str
http_get(path); find_product_tab(item_id); create_tab(url)
http_get(path, host=None); find_product_tab(item_id, host=None); create_tab(url, host=None)
class CDP: send/ev/val/object_id/drag/close # suppress_origin、trust_env=False
```
## editor 模块(`app/editor.py`,待建,重构自现有脚本)
## editor 模块(`app/editor.py`,已建,重构自现有脚本)
```python
is_logged_in(account) -> bool # 重定向登录页或缺 SPC_ST → False
@@ -130,7 +130,7 @@ collect(account, task) -> dict # -> {old_title, old_cover_path}
# 应用
change_title(cdp, new_title) -> dict # {ok, value, modelvalue},要求三者相等
replace_cover(cdp, image_win_path) -> dict # 上传→等CDN→拖第一位;满9张先删第一张
replace_cover(cdp, image_win_path) -> dict # 上传→等CDN→拖第一位;满9张暂返回 FULL_IMAGE_SLOTS,删除流程留给 T-502
click_update(cdp) -> dict # {clicked, reason};禁用则记失败
apply_task(account, task) -> dict # 对已生成任务:换标题+换封面+点「更新」提交(调用前必须已做批量确认)
# -> {committed, error}