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

Function receiveRedRain

jd_live_redrain.js:212–243  ·  view source on GitHub ↗
(actId)

Source from the content-addressed store, hash-verified

210}
211
212function receiveRedRain(actId) {
213 return new Promise(resolve => {
214 const body = { actId };
215 $.get(taskUrl('noahRedRainLottery', body), (err, resp, data) => {
216 try {
217 if (err) {
218 console.log(`${JSON.stringify(err)}`)
219 console.log(`${$.name} API请求失败,请检查网路重试`)
220 } else {
221 if (safeGet(data)) {
222 data = JSON.parse(data);
223 if (data.subCode === '0') {
224 console.log(`领取成功,获得${JSON.stringify(data.lotteryResult)}`)
225 // message+= `领取成功,获得${JSON.stringify(data.lotteryResult)}\n`
226 message += `领取成功,获得 ${(data.lotteryResult.jPeasList[0].quantity)}京豆`
227 allMessage += `京东账号${$.index}${$.nickName || $.UserName}\n领取成功,获得 ${(data.lotteryResult.jPeasList[0].quantity)}京豆${$.index !== cookiesArr.length ? '\n\n' : ''}`;
228 } else if (data.subCode === '8') {
229 console.log(`领取失败:本场已领过`)
230 message += `领取失败,本场已领过`;
231 } else {
232 console.log(`异常:${JSON.stringify(data)}`)
233 }
234 }
235 }
236 } catch (e) {
237 $.logErr(e, resp)
238 } finally {
239 resolve();
240 }
241 })
242 })
243}
244
245function taskGetUrl(url, body) {
246 return {

Callers 1

jd_live_redrain.jsFile · 0.70

Calls 5

taskUrlFunction · 0.70
safeGetFunction · 0.70
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected