aliChoice:类目 cat_fb 回退 + 失败记录带 errItems;记录首次批量成败分类(健康类目强制商品说明书)
This commit is contained in:
1 parent
0466698490
commit
a5c32e4726
3 files changed
+84
-2
No files matched your search
@@ -109,7 +109,14 @@ for (const t of tasks) {
|
||||
await wait(6000);
|
||||
log(` 备货类型: ${await pickFirstOption(c, '备货类型')}`);
|
||||
await wait(3000);
|
||||
const cat = await selectCategory(c, it.cat_kw || '发夹', it.cat_kw);
|
||||
// 类目:cat_kw 搜不到就依次试 cat_fb(tk_input 里给的后备品类词)
|
||||
let cat = await selectCategory(c, it.cat_kw || '发夹', it.cat_kw);
|
||||
if (!String(cat).startsWith('path:')) {
|
||||
for (const fb of (it.cat_fb || []).slice(0, 3)) {
|
||||
cat = await selectCategory(c, fb, fb);
|
||||
if (String(cat).startsWith('path:')) { log(` 类目回退到「${fb}」`); break; }
|
||||
}
|
||||
}
|
||||
log(` 类目: ${String(cat).slice(0, 110)}`);
|
||||
if (!String(cat).startsWith('path:')) throw new Error('选类目失败:' + cat);
|
||||
await wait(6000);
|
||||
@@ -144,8 +151,12 @@ for (const t of tasks) {
|
||||
mods = String(await c.evalJS(`JSON.stringify([...document.querySelectorAll('.ant-modal')].filter(e=>e.offsetParent!==null).map(e=>(e.innerText||'').replace(/\\s+/g,' ').trim().slice(0,110)))`));
|
||||
}
|
||||
const cap = await readHook(c);
|
||||
const errItems = String(await c.evalJS(`JSON.stringify([...document.querySelectorAll('.ant-form-item-has-error')].map(x=>{
|
||||
const l=x.querySelector('label'); const t=l?(l.innerText||'').replace(/\\s+/g,' ').trim().slice(0,30):'(无label)';
|
||||
const red=[...x.querySelectorAll('.text-red-500')].map(e=>(e.innerText||'').trim().slice(0,30)).filter(Boolean);
|
||||
return t+':'+red.join('/');}).slice(0,6))`));
|
||||
const ok = /已保存|保存成功|待发布/.test(mods);
|
||||
done[t.pid] = ok ? { ok: true } : { ok: false, mods: mods.slice(0, 160), hook: String(cap).slice(-240) };
|
||||
done[t.pid] = ok ? { ok: true } : { ok: false, errItems: errItems.slice(0, 260), mods: mods.slice(0, 120), hook: String(cap).slice(-200) };
|
||||
log(ok ? ' ✓ 已保存到待发布' : ` ✗ 失败 ${mods.slice(0, 110)} | ${String(cap).slice(-170)}`);
|
||||
} catch (e) {
|
||||
done[t.pid] = { ok: false, msg: String(e).slice(0, 240) };
|
||||
|
||||
Reference in new issue
Block a user