From d6d9b99b055241942e95fdc3c579f1a0616785ea Mon Sep 17 00:00:00 2001 From: KingRan Date: Fri, 18 Mar 2022 08:41:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_plantBean.js | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/jd_plantBean.js b/jd_plantBean.js index 7ee4f2b..79887f8 100644 --- a/jd_plantBean.js +++ b/jd_plantBean.js @@ -277,16 +277,20 @@ async function doTask() { const { data } = $.shopTaskListRes; let goodShopListARR = [], moreShopListARR = [], shopList = []; const { goodShopList, moreShopList } = data; - for (let i of goodShopList) { - if (i.taskState === '2') { - goodShopListARR.push(i); - } - } - for (let j of moreShopList) { - if (j.taskState === '2') { - moreShopListARR.push(j); - } - } + if (goodShopList) { + for (let i of goodShopList) { + if (i.taskState === '2') { + goodShopListARR.push(i); + } + } + } + if (moreShopList) { + for (let j of moreShopList) { + if (j.taskState === '2') { + moreShopListARR.push(j); + } + } + } shopList = goodShopListARR.concat(moreShopListARR); for (let shop of shopList) { const { shopId, shopTaskId } = shop;