From d0625676b4dbe6eae5393732ce3719121e3d3b38 Mon Sep 17 00:00:00 2001 From: lxk0301 <778732665@qq.com> Date: Fri, 4 Dec 2020 18:55:31 +0800 Subject: [PATCH] update --- jd_dreamFactory.js | 47 ++++++++++++++++++++++++++++++++++++++++------ jd_small_home.js | 2 +- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/jd_dreamFactory.js b/jd_dreamFactory.js index 6dee0bd3..cf247cc3 100644 --- a/jd_dreamFactory.js +++ b/jd_dreamFactory.js @@ -1,6 +1,6 @@ /* 京东京喜工厂 -更新时间:2020-12-03 +更新时间:2020-12-04 活动入口 :京东APP->游戏与互动->查看更多->京喜工厂 或者: 京东APP首页搜索 "玩一玩" ,造物工厂即可 @@ -887,11 +887,12 @@ function CreateTuan() { }) } async function joinLeaderTuan() { - for (let tuanId of tuanIDs) { - if (tuanId) { - await JoinTuan(tuanId); - } - } + await updateTuanIds(); + if (!$.tuanIdS) await updateTuanIdsCDN(); + for (let tuanId of $.tuanIdS.tuanIds) { + if (!tuanId) continue + await JoinTuan(tuanId); + } } function JoinTuan(tuanId) { return new Promise((resolve) => { @@ -1044,6 +1045,40 @@ function tuanAward(activeId, tuanId, isTuanLeader = true) { }) }) } +function updateTuanIds(url = 'https://raw.githubusercontent.com/lxk0301/updateTeam/master/jd_updateFactoryTuanId.json') { + return new Promise(resolve => { + $.get({url}, (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + } else { + $.tuanIdS = JSON.parse(data); + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} +function updateTuanIdsCDN(url = 'https://cdn.jsdelivr.net/gh/lxk0301/updateTeam@master/jd_updateFactoryTuanId.json') { + return new Promise(resolve => { + $.get({url}, (err, resp, data) => { + try { + if (err) { + console.log(`${JSON.stringify(err)}`) + } else { + $.tuanIdS = JSON.parse(data); + } + } catch (e) { + $.logErr(e, resp) + } finally { + resolve(); + } + }) + }) +} async function showMsg() { return new Promise(async resolve => { let ctrTemp; diff --git a/jd_small_home.js b/jd_small_home.js index e991d08d..eb8c0985 100644 --- a/jd_small_home.js +++ b/jd_small_home.js @@ -157,7 +157,7 @@ async function doChannelsListTask(taskId, taskType) { } async function helpFriends() { await updateInviteCode(); - if (!$.updatePkActivityIdRes) await updateInviteCodeCDN(); + if (!$.inviteCodes) await updateInviteCodeCDN(); for (let item of $.inviteCodes.inviteCode) { if (!item) continue await createAssistUser(item, $.createAssistUserID || "1318106976846299138");