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

Function receiveEnergyProp

jd_speed.js:338–388  ·  view source on GitHub ↗
(CID)

Source from the content-addressed store, hash-verified

336
337//领取可用的燃料
338function receiveEnergyProp(CID) {
339 return new Promise((resolve) => {
340 var NumTask = 0;
341 if (CID) {
342 let count = 0
343 for (let i = 0; i < CID.length; i++) {
344 let body = {
345 "source":"game",
346 "energy_id": CID[i]
347 }
348 const TUrl = {
349 // url: JD_API_HOST + '?appid=memberTaskCenter&functionId=energyProp_gain&body=%7B%22source%22%3A%22game%22%2C%22energy_id%22%3A' + CID[i] + '%7D',
350 url: `${JD_API_HOST}?appid=memberTaskCenter&functionId=energyProp_gain&body=${escape(JSON.stringify(body))}`,
351 headers: {
352 Referer: 'https://h5.m.jd.com/babelDiy/Zeus/6yCQo2eDJPbyPXrC3eMCtMWZ9ey/index.html',
353 Cookie: cookie
354 }
355 };
356 count += 1
357 $.get(TUrl, (error, response, data) => {
358 try {
359 if (error) {
360 console.log("\n天天加速-领取道具请求失败 ‼️‼️")
361 console.log(`${JSON.stringify(error)}`)
362 } else {
363 if (data) {
364 const cc = JSON.parse(data)
365 console.log("\n天天加速-尝试领取第" + count + "个可用燃料")
366 if (cc.message === 'success') {
367 NumTask += 1
368 }
369 } else {
370 console.log(`京豆api返回数据为空,请检查自身原因`)
371 }
372 }
373 } catch (eor) {
374 // $.msg("天天加速-领取可用燃料" + eor.name + "‼️", JSON.stringify(eor), eor.message)
375 $.logErr(e, resp)
376 } finally {
377 if (CID.length === count) {
378 console.log("\n天天加速-已成功领取" + NumTask + "个可用燃料")
379 resolve(NumTask)
380 }
381 }
382 })
383 }
384 } else {
385 resolve(NumTask)
386 }
387 })
388}
389
390//检查剩余燃料
391function energyPropUsaleList(EID) {

Callers 1

jDSpeedUpFunction · 0.85

Calls 3

getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected