diff --git a/docker/Readme.md b/docker/Readme.md index 081b8710..5e411e1d 100644 --- a/docker/Readme.md +++ b/docker/Readme.md @@ -230,7 +230,7 @@ jd_scripts `docker exec -it jd_scripts /bin/sh -c 'env'` 查看设置的环境变量 - `docker exec -it jd_scripts /bin/sh -c 'git pull'` 手动更新jd_scripts仓库最新脚本 + `docker exec -it jd_scripts sh -c "docker_entrypoint.sh"` 手动更新jd_scripts仓库最新脚本 `docker exec -it jd_scripts /bin/sh` 仅进入容器命令 diff --git a/jd_dreamFactory.js b/jd_dreamFactory.js index 2db5c973..a269f9db 100644 --- a/jd_dreamFactory.js +++ b/jd_dreamFactory.js @@ -1,7 +1,7 @@ /* 京东京喜工厂 -更新时间:2021-3-25 修复做任务、收集电力出现火爆,不能完成任务 -重新计算h5st验证 +更新时间:2021-3-31 +修复做任务、收集电力出现火爆,不能完成任务,重新计算h5st验证 参考自 :https://www.orzlee.com/web-development/2021/03/03/lxk0301-jingdong-signin-scriptjingxi-factory-solves-the-problem-of-unable-to-signin.html 活动入口:京东APP-游戏与互动-查看更多-京喜工厂 或者: 京东APP首页搜索 "玩一玩" ,造物工厂即可 @@ -80,7 +80,8 @@ if ($.isNode()) { $.pickEle = 0; $.pickFriendEle = 0; $.friendList = []; - $.canHelpFlag = true;//能否助力朋友 + $.canHelpFlag = true;//能否助力朋友(招工) + $.tuanNum = 0;//成团人数 await TotalBean(); console.log(`\n******开始【京东账号${$.index}】${$.nickName || $.UserName}*********\n`); if (!$.isLogin) { @@ -98,17 +99,18 @@ if ($.isNode()) { if (cookiesArr[i]) { cookie = cookiesArr[i]; $.isLogin = true; + $.canHelp = true;//能否参团 await TotalBean(); if (!$.isLogin) { continue } - console.log(`\n参加作者的团\n`); await joinLeaderTuan();//参团 $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]) - if (cookiesArr && cookiesArr.length < 2) return + if ((cookiesArr && cookiesArr.length < $.tuanNum || 5) || !$.canHelp) return console.log(`\n账号内部相互进团\n`); for (let item of $.tuanIds) { - console.log(`${$.UserName} 去参加团 ${item}\n`); + console.log(`\n${$.UserName} 去参加团 ${item}`); + if (!$.canHelp) break; await JoinTuan(item); } } @@ -702,7 +704,7 @@ function DrawProductionStagePrize() { console.log(`${JSON.stringify(err)}`) console.log(`${$.name} API请求失败,请检查网路重试`) } else { - console.log(`领取红包功能(测试中):${data}`); + console.log(`开幸运红包:${data}`); // if (safeGet(data)) { // data = JSON.parse(data); // if (data['ret'] === 0) { @@ -722,14 +724,14 @@ function DrawProductionStagePrize() { } async function PickUp(encryptPin = $.encryptPin, help = false) { $.pickUpMyselfComponent = true; - const GetUserComponentRes = await GetUserComponent(encryptPin, 500); + const GetUserComponentRes = await GetUserComponent(encryptPin, 1300); if (GetUserComponentRes && GetUserComponentRes['ret'] === 0) { const { componentList } = GetUserComponentRes['data']; if (componentList && componentList.length <= 0) { if (help) { - $.log(`好友【${encryptPin}】地下暂无零件可收`) + $.log(`好友【${encryptPin}】地下暂无零件可收\n`) } else { - $.log(`自家地下暂无零件可收`) + $.log(`自家地下暂无零件可收\n`) } $.pickUpMyselfComponent = false; } @@ -748,9 +750,9 @@ async function PickUp(encryptPin = $.encryptPin, help = false) { } } else { if (help) { - console.log(`收好友[${encryptPin}]零件失败:${PickUpComponentRes.msg},直接跳出`) + console.log(`收好友[${encryptPin}]零件失败:${PickUpComponentRes.msg},直接跳出\n`) } else { - console.log(`收自己地下零件失败:${PickUpComponentRes.msg},直接跳出`); + console.log(`收自己地下零件失败:${PickUpComponentRes.msg},直接跳出\n`); $.pickUpMyselfComponent = false; } break @@ -831,13 +833,11 @@ async function stealFriend() { // return // } await getFriendList(); - $.friendList = [...new Set($.friendList)]; + $.friendList = [...new Set($.friendList)].filter(vo => !!vo && vo['newFlag'] !== 1); + console.log(`查询好友列表完成,共${$.friendList.length}好友,下面开始拾取好友地下的零件\n`); for (let i = 0; i < $.friendList.length; i++) { - let pin = $.friendList[i];//好友的encryptPin - if (pin === 'V5LkjP4WRyjeCKR9VRwcRX0bBuTz7MEK0-E99EJ7u0k=' || pin === 'Bo-jnVs_m9uBvbRzraXcSA==') { - continue - } - console.log(`开始收取第 ${i + 1} 个好友 ${pin} 地下零件`) + let pin = $.friendList[i]['encryptPin'];//好友的encryptPin + console.log(`\n开始收取第 ${i + 1} 个好友 【${$.friendList[i]['nickName']}】 地下零件 collectFlag:${$.friendList[i]['collectFlag']}`) await PickUp(pin, true); // await getFactoryIdByPin(pin);//获取好友工厂ID // if ($.stealFactoryId) await collectElectricity($.stealFactoryId,true, pin); @@ -856,15 +856,15 @@ function getFriendList(sort = 0) { if (data['ret'] === 0) { data = data['data']; if (data.list && data.list.length <= 0) { - console.log(`查询好友列表完成,共${$.friendList.length}好友,下面开始拾取好友地下的零件\n`); + // console.log(`查询好友列表完成,共${$.friendList.length}好友,下面开始拾取好友地下的零件\n`); return } let friendsEncryptPins = []; for (let item of data.list) { - friendsEncryptPins.push(item.encryptPin); + friendsEncryptPins.push(item); } $.friendList = [...$.friendList, ...friendsEncryptPins]; - if (!$.isNode()) return + // if (!$.isNode()) return await getFriendList(data.sort); } else { console.log(`QueryFactoryManagerList异常:${JSON.stringify(data)}`) @@ -930,6 +930,7 @@ async function tuanActivity() { } for (let item of tuanInfo) { const { realTuanNum, tuanNum, userInfo } = item; + $.tuanNum = tuanNum || 0; $.log(`\n开团情况:${realTuanNum}/${tuanNum}\n`); if (realTuanNum === tuanNum) { for (let user of userInfo) { @@ -953,19 +954,13 @@ async function tuanActivity() { } } async function joinLeaderTuan() { - $.tuanIdS = null; - if (!$.tuanIdS) await updateTuanIdsCDN('https://gitee.com/lxk0301/updateTeam/raw/master/shareCodes/jd_updateFactoryTuanId.json'); - if ($.tuanIdS && $.tuanIdS.tuanIds) { - for (let tuanId of $.tuanIdS.tuanIds) { - if (!tuanId) continue - await JoinTuan(tuanId); - } - } - $.tuanIdS = null; - if (!$.tuanIdS) await updateTuanIdsCDN('https://gitee.com/shylocks/updateTeam/raw/main/jd_updateFactoryTuanId.json'); - if ($.tuanIdS && $.tuanIdS.tuanIds) { - for (let tuanId of $.tuanIdS.tuanIds) { + let res = await updateTuanIdsCDN(), res2 = await updateTuanIdsCDN("https://gitee.com/shylocks/updateTeam/raw/main/jd_updateFactoryTuanId.json") + $.authorTuanIds = [...(res && res.tuanIds || []),...(res2 && res2.tuanIds || [])] + if ($.authorTuanIds && $.authorTuanIds.length) { + console.log(`\n参加作者的团`); + for (let tuanId of $.authorTuanIds) { if (!tuanId) continue + if (!$.canHelp) break; await JoinTuan(tuanId); } } @@ -1071,9 +1066,13 @@ function JoinTuan(tuanId, stk = '_time,activeId,tuanId') { if (safeGet(data)) { data = JSON.parse(data); if (data['ret'] === 0) { - console.log(`参团成功\n${JSON.stringify(data)}\n`); + console.log(`参团成功:${JSON.stringify(data)}\n`); + } else if (data['ret'] === 10005 || data['ret'] === 10206) { + //火爆,或者今日参团机会已耗尽 + console.log(`参团失败:${JSON.stringify(data)}\n`); + $.canHelp = false; } else { - console.log(`参团失败:${JSON.stringify(data)}`); + console.log(`参团失败:${JSON.stringify(data)}\n`); } } } @@ -1177,9 +1176,10 @@ function tuanAward(activeId, tuanId, isTuanLeader = true) { }) } -function updateTuanIdsCDN(url) { +function updateTuanIdsCDN(url = 'https://gitee.com/lxk0301/updateTeam/raw/master/shareCodes/jd_updateFactoryTuanId.json') { return new Promise(async resolve => { $.get({url, + timeout: 20000, 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" }}, (err, resp, data) => { @@ -1188,17 +1188,17 @@ function updateTuanIdsCDN(url) { console.log(`${JSON.stringify(err)}`) } else { if (safeGet(data)) { - $.tuanIdS = JSON.parse(data); + $.tuanConfigs = data = JSON.parse(data); } } } catch (e) { $.logErr(e, resp) } finally { - resolve(); + resolve(data || []); } }) - await $.wait(3000) - resolve(); + await $.wait(20000) + resolve([]); }) } @@ -1314,11 +1314,13 @@ function shareCodesFormat() { function requireConfig() { return new Promise(async resolve => { await updateTuanIdsCDN('https://gitee.com/lxk0301/updateTeam/raw/master/shareCodes/jd_updateFactoryTuanId.json'); - if ($.tuanIdS && $.tuanIdS.tuanActiveId) { - tuanActiveId = $.tuanIdS.tuanActiveId; + if ($.tuanConfigs && $.tuanConfigs['tuanActiveId']) { + tuanActiveId = $.tuanConfigs['tuanActiveId']; + console.log(`拼团活动ID: 获取成功 ${tuanActiveId}`) + } else { + console.log(`拼团活动ID:获取失败`) } console.log(`开始获取${$.name}配置文件\n`); - console.log(`tuanActiveId: ${tuanActiveId}`) //Node.js用户请在jdCookie.js处填写京东ck; const shareCodes = $.isNode() ? require('./jdDreamFactoryShareCodes.js') : ''; console.log(`共${cookiesArr.length}个京东账号\n`);