()
| 141 | } |
| 142 | //参加双人赛跑 |
| 143 | async function joinTwoPeopleRun() { |
| 144 | joyRunFlag = $.getdata('joyRunFlag') ? $.getdata('joyRunFlag') : joyRunFlag; |
| 145 | if ($.isNode() && process.env.JOY_RUN_FLAG) { |
| 146 | joyRunFlag = process.env.JOY_RUN_FLAG; |
| 147 | } |
| 148 | if (`${joyRunFlag}` === 'true') { |
| 149 | let teamLevelTemp = []; |
| 150 | teamLevelTemp = $.isNode() ? (process.env.JOY_TEAM_LEVEL ? process.env.JOY_TEAM_LEVEL.split('&') : teamLevel.split('&')) : ($.getdata('JOY_TEAM_LEVEL') ? $.getdata('JOY_TEAM_LEVEL').split('&') : teamLevel.split('&')); |
| 151 | teamLevelTemp = teamLevelTemp[$.index - 1] ? teamLevelTemp[$.index - 1] : 2; |
| 152 | await getPetRace(); |
| 153 | console.log(`\n===以下是京东账号${$.index} ${$.nickName} ${$.petRaceResult.data.teamLimitCount || teamLevelTemp}人赛跑信息===\n`) |
| 154 | if ($.petRaceResult) { |
| 155 | let petRaceResult = $.petRaceResult.data.petRaceResult; |
| 156 | // let raceUsers = $.petRaceResult.data.raceUsers; |
| 157 | console.log(`赛跑状态:${petRaceResult}\n`); |
| 158 | if (petRaceResult === 'not_participate') { |
| 159 | console.log(`暂未参赛,现在为您参加${teamLevelTemp}人赛跑`); |
| 160 | await runMatch(teamLevelTemp * 1); |
| 161 | if ($.runMatchResult.success) { |
| 162 | await getWinCoin(); |
| 163 | console.log(`${$.getWinCoinRes.data.teamLimitCount || teamLevelTemp}人赛跑参加成功\n`); |
| 164 | message += `${$.getWinCoinRes.data.teamLimitCount || teamLevelTemp}人赛跑:成功参加\n`; |
| 165 | // if ($.getWinCoinRes.data['supplyOrder']) await energySupplyStation($.getWinCoinRes.data['supplyOrder']); |
| 166 | await energySupplyStation('2'); |
| 167 | // petRaceResult = $.petRaceResult.data.petRaceResult; |
| 168 | // await getRankList(); |
| 169 | console.log(`双人赛跑助力请自己手动去邀请好友,脚本不带赛跑助力功能\n`); |
| 170 | } |
| 171 | } |
| 172 | if (petRaceResult === 'unbegin') { |
| 173 | console.log('比赛还未开始,请九点再来'); |
| 174 | } |
| 175 | if (petRaceResult === 'time_over') { |
| 176 | console.log('今日参赛的比赛已经结束,请明天九点再来'); |
| 177 | } |
| 178 | if (petRaceResult === 'unreceive') { |
| 179 | console.log('今日参赛的比赛已经结束,现在领取奖励'); |
| 180 | await getWinCoin(); |
| 181 | let winCoin = 0; |
| 182 | if ($.getWinCoinRes && $.getWinCoinRes.success) { |
| 183 | winCoin = $.getWinCoinRes.data.winCoin; |
| 184 | } |
| 185 | await receiveJoyRunAward(); |
| 186 | console.log(`领取赛跑奖励结果:${JSON.stringify($.receiveJoyRunAwardRes)}`) |
| 187 | if ($.receiveJoyRunAwardRes.success) { |
| 188 | joyRunNotify = $.isNode() ? (process.env.JOY_RUN_NOTIFY ? process.env.JOY_RUN_NOTIFY : `${joyRunNotify}`) : ($.getdata('joyRunNotify') ? $.getdata('joyRunNotify') : `${joyRunNotify}`); |
| 189 | $.msg($.name, '', `【京东账号${$.index}】${$.nickName}\n太棒了,${$.name}赛跑取得获胜\n恭喜您已获得${winCoin}积分奖励`); |
| 190 | allMessage += `京东账号${$.index}${$.nickName}\n太棒了,${$.name}赛跑取得获胜\n恭喜您已获得${winCoin}积分奖励${$.index !== cookiesArr.length ? '\n\n' : ''}`; |
| 191 | // if ($.isNode() && joyRunNotify === 'true') await notify.sendNotify(`${$.name} - 京东账号${$.index} - ${$.nickName}`, `京东账号${$.index}${$.nickName}\n太棒了,${$.name}赛跑取得获胜\n恭喜您已获得${winCoin}积分奖励`) |
| 192 | } |
| 193 | } |
| 194 | if (petRaceResult === 'participate') { |
| 195 | // if ($.getWinCoinRes.data['supplyOrder']) await energySupplyStation($.getWinCoinRes.data['supplyOrder']); |
| 196 | await energySupplyStation('2'); |
| 197 | await getRankList(); |
| 198 | if($.raceUsers && $.raceUsers.length > 0) { |
| 199 | for (let index = 0; index < $.raceUsers.length; index++) { |
| 200 | if (index === 0) { |
no test coverage detected