diff --git a/jd_bean_home.js b/jd_bean_home.js index 1270acb2..992fbcaf 100644 --- a/jd_bean_home.js +++ b/jd_bean_home.js @@ -41,8 +41,8 @@ if ($.isNode()) { const JD_API_HOST = 'https://api.m.jd.com/'; !(async () => { $.newShareCodes = [] - // await getAuthorShareCode(); - // await getAuthorShareCode2(); + await getAuthorShareCode(); + await getAuthorShareCode2(); if (!cookiesArr[0]) { $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/bean/signIndex.action', {"open-url": "https://bean.m.jd.com/bean/signIndex.action"}); return; @@ -68,34 +68,34 @@ const JD_API_HOST = 'https://api.m.jd.com/'; await jdBeanHome(); } } - // for (let i = 0; i < cookiesArr.length; i++) { - // if (cookiesArr[i]) { - // $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]) - // console.log(`${$.UserName}去帮助下一个人`) - // cookie = cookiesArr[i]; - // if ($.newShareCodes.length > 1) { - // let code = $.newShareCodes[(i + 1) % $.newShareCodes.length] - // await help(code[0], code[1]) - // } - // if (helpAuthor && $.authorCode) { - // console.log(`去帮助作者`) - // const helpRes = await help($.authorCode[0], $.authorCode[1]) - // if (helpRes && helpRes.data.respCode === 'SG209') { - // console.log(`助力次数已耗尽,跳出助力`) - // break; - // } - // } - // if (helpAuthor && $.authorCode2) { - // for (let code of $.authorCode2) { - // const helpRes = await help(code.shareCode, code.groupCode); - // if (helpRes && helpRes.data.respCode === 'SG209') { - // console.log(`助力次数已耗尽,跳出助力`) - // break; - // } - // } - // } - // } - // } + for (let i = 0; i < cookiesArr.length; i++) { + if (cookiesArr[i]) { + $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]) + console.log(`${$.UserName}去帮助下一个人`) + cookie = cookiesArr[i]; + if ($.newShareCodes.length > 1) { + let code = $.newShareCodes[(i + 1) % $.newShareCodes.length] + await help(code[0], code[1]) + } + if (helpAuthor && $.authorCode) { + console.log(`去帮助作者`) + const helpRes = await help($.authorCode[0], $.authorCode[1]) + if (helpRes && helpRes.data.respCode === 'SG209') { + console.log(`助力次数已耗尽,跳出助力`) + break; + } + } + if (helpAuthor && $.authorCode2) { + for (let code of $.authorCode2) { + const helpRes = await help(code.shareCode, code.groupCode); + if (helpRes && helpRes.data.respCode === 'SG209') { + console.log(`助力次数已耗尽,跳出助力`) + break; + } + } + } + } + } })() .catch((e) => { $.log('', `❌ ${$.name}, 失败! 原因: ${e}!`, '')