From a7ae93c761417969979ab4a789006a5c8d234d38 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Sat, 12 Dec 2020 16:58:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/ISSUE_TEMPLATE/bug_report.md | 79 ----------------------- .github/ISSUE_TEMPLATE/feature_request.md | 44 ------------- jd_bean_home.js | 41 ++++++++++-- 3 files changed, 37 insertions(+), 127 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 00a9d7ec..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,79 +0,0 @@ ---- -name: Bug 反馈 -about: 运行js脚本时出现bug -title: '' -labels: '' -assignees: '' - ---- - - - - - - - - - - - - -## 1.关于你要提交的问题 - -Q:是否搜索了issue(包括已关闭的issue) -- [ ] 没有类似的issue - -Q:是否仔细阅读了教程 -- [ ] 已仔细阅读教程 - -## 2. 你使用的哪种部署方法 - - - - - - -- [ ] 方法一:本地安装Node.js -- [ ] 方法二:腾讯云函数 -- [ ] 方法三:Docker办法一 -- [ ] 方法三:Docker办法二 -- [ ] 方法三:Docker办法三 -- [ ] 方法四:iOS系统的代理软件 - - -## 3. 详细叙述 -### (1) 具体问题 -A: - -### (2) 详细日志 -A: - - - - - -## 4.软件版本和 npm install 结果 -### (1) Node.js版本 - -A: - -### (2) npm版本 - -A: - -### (3)npm install的日志 - -A: diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index fb79c623..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,44 +0,0 @@ ---- -name: 功能与建议 -about: 请求实现新功能或改进已有功能 -title: '' -labels: '' -assignees: '' - ---- - - - - - - - - - - - - -## 期望增加的功能 - -A: - - - - - -## 入口 - -A: diff --git a/jd_bean_home.js b/jd_bean_home.js index d69c9642..136287d7 100644 --- a/jd_bean_home.js +++ b/jd_bean_home.js @@ -46,7 +46,8 @@ if ($.isNode()) { const JD_API_HOST = 'https://api.m.jd.com/'; !(async () => { $.newShareCodes = [] - await getAuthorShareCode() + await getAuthorShareCode(); + await getAuthorShareCode2(); if (!cookiesArr[0]) { $.msg($.name, '【提示】请先获取京东账号一cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"}); return; @@ -85,7 +86,20 @@ const JD_API_HOST = 'https://api.m.jd.com/'; } if (helpAuthor && $.authorCode) { console.log(`去帮助作者`) - await help($.authorCode[0], $.authorCode[1]) + 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; + } + } } } } @@ -121,7 +135,26 @@ function getAuthorShareCode() { }) }) } - +function getAuthorShareCode2() { + return new Promise(resolve => { + $.get({url: "https://gitee.com/lxk0301/updateTeam/raw/master/jd_updateBeanHome.json",headers:{ + "User-Agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1 Edg/87.0.4280.88" + }}, async (err, resp, data) => { + try { + if (err) { + } else { + if (safeGet(data)) { + $.authorCode2 = JSON.parse(data); + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} function getUserInfo() { return new Promise(resolve => { $.post(taskUrl('signBeanGroupStageIndex', 'body'), async (err, resp, data) => { @@ -219,7 +252,7 @@ function help(shareCode, groupCode, isTask = 0) { } catch (e) { $.logErr(e, resp) } finally { - resolve(); + resolve(data); } }) })