MCPcopy Create free account
hub / github.com/Semporia/Scripts / help

Function help

jd_lotteryMachine.js:46–99  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44 }).catch((err) => console.log(`更新jd_lotteryMachine.js文件 CDN异常`, err));
45}
46async function help() {
47 if (!cookiesArr[0]) {
48 $.msg($.name, '【提示】请先获取cookie\n直接使用NobyDa的京东签到获取', 'https://bean.m.jd.com/', {"open-url": "https://bean.m.jd.com/"});
49 return;
50 }
51 console.log(`\n\n当前共有${appIdArr.length}个抽奖机活动\n\n`);
52 for (let j in appIdArr) {
53 $.invites = [];
54 $.appId = appIdArr[j];
55 $.appIndex = parseInt(j) + 1;
56 homeDataFunPrefix = homeDataFunPrefixArr[j] || 'healthyDay';
57 console.log(`\n第${parseInt(j) + 1}个抽奖活动【${$.appId}】`)
58 console.log(`functionId:${homeDataFunPrefix}_getHomeData`);
59 $.acHelpFlag = true;//该活动是否需要助力,true需要,false 不需要
60 for (let i = 0; i < cookiesArr.length; i++) {
61 cookie = cookiesArr[i];
62 if (cookie) {
63 $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
64 console.log(`\n***************开始京东账号${i + 1} ${$.UserName}***************`)
65 await interact_template_getHomeData();
66 }
67 if (i === 0 && !$.acHelpFlag) {
68 console.log(`\n第${parseInt(j) + 1}个抽奖活动【${$.appId}】,不需要助力`);
69 break;
70 }
71 }
72 if ($.invites.length > 0) {
73 $.allShareId[appIdArr[j]] = $.invites;
74 }
75 }
76 // console.log('$.allShareId', JSON.stringify($.allShareId))
77 if (!cookiesArr || cookiesArr.length < 2) return
78 for (let i = 0; i < cookiesArr.length; i++) {
79 cookie = cookiesArr[i];
80 $.index = i + 1;
81 $.UserName = decodeURIComponent(cookie.match(/pt_pin=([^; ]+)(?=;?)/) && cookie.match(/pt_pin=([^; ]+)(?=;?)/)[1]);
82 for (let oneAppId in $.allShareId) {
83 let oneAcHelpList = $.allShareId[oneAppId];
84 for (let j = 0; j < oneAcHelpList.length; j++) {
85 $.item = oneAcHelpList[j];
86 if ($.UserName === $.item['userName']) continue;
87 if (!$.item['taskToken'] && !$.item['taskId'] || $.item['max']) continue
88 console.log(`账号${i + 1} ${$.UserName} 去助力账号 ${$.item['userName']}的第${$.item['index']}个抽奖活动【${$.item['appId']}】,邀请码 【${$.item['taskToken']}】`)
89 $.canHelp = true;
90 collectScoreFunPrefix = collectScoreFunPrefixArr[$.item['index'] - 1] || 'harmony'
91 await harmony_collectScore();
92 if (!$.canHelp) {
93 // console.log(`跳出`);
94 break;//此处如果break,则遇到第一个活动就无助力机会时,不会继续助力第二个活动了
95 }
96 }
97 }
98 }
99}
100function interact_template_getHomeData(timeout = 0) {
101 return new Promise((resolve) => {
102 setTimeout( ()=>{

Callers 1

mainFunction · 0.70

Calls 4

harmony_collectScoreFunction · 0.70
msgMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected