diff --git a/jd_cash.js b/jd_cash.js index 736fe9ec..7c9aece0 100644 --- a/jd_cash.js +++ b/jd_cash.js @@ -48,6 +48,7 @@ const JD_API_HOST = 'https://api.m.jd.com/client.action'; } await requireConfig() await getAuthorShareCode(); + await getAuthorShareCode2(); for (let i = 0; i < cookiesArr.length; i++) { if (cookiesArr[i]) { cookie = cookiesArr[i]; @@ -105,7 +106,7 @@ function index(info=false) { 'shareDate': data.data.result.shareDate } $.shareDate = data.data.result.shareDate; - $.log(`shareDate: ${$.shareDate}`) + // $.log(`shareDate: ${$.shareDate}`) // console.log(helpInfo) for(let task of data.data.result.taskInfos){ if (task.type === 4) { @@ -357,9 +358,9 @@ function taskUrl(functionId, body = {}) { } } -function getAuthorShareCode() { +function getAuthorShareCode(url = "https://gitee.com/shylocks/updateTeam/raw/main/jd_cash.json") { return new Promise(resolve => { - $.get({url: "https://gitee.com/shylocks/updateTeam/raw/main/jd_cash.json",headers:{ + $.get({url, 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) => { $.authorCode = []; @@ -376,6 +377,28 @@ function getAuthorShareCode() { }) }) } +function getAuthorShareCode2(url = "https://gitee.com/lxk0301/updateTeam/raw/master/shareCodes/jd_updateCash.json") { + return new Promise(resolve => { + $.get({url, 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) => { + $.authorCode2 = []; + try { + if (err) { + } else { + $.authorCode2 = JSON.parse(data) + if ($.authorCode2 && $.authorCode2.length) { + $.authorCode.push(...$.authorCode2); + } + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} function TotalBean() { return new Promise(async resolve => { const options = {