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

Function combatHelp

jd_joy_run.js:454–492  ·  view source on GitHub ↗
(friendPin)

Source from the content-addressed store, hash-verified

452 // }
453}
454function combatHelp(friendPin) {
455 return new Promise(resolve => {
456 headers.Cookie = cookie;
457 headers.LKYLToken = $.LKYLToken;
458 let opt = {
459 // url: "//jdjoy.jd.com/common/pet/getPetTaskConfig?reqSource=h5",
460 url: `//draw.jdfcloud.com//common/pet/combat/help?friendPin=${encodeURI(friendPin)}&invokeKey=qRKHmL4sna8ZOP9F`,
461 method: "GET",
462 data: {},
463 credentials: "include",
464 header: {"content-type": "application/json"}
465 }
466 const url = "https:"+ taroRequest(opt)['url'] + $.validate;
467 const options = {
468 url,
469 headers
470 }
471 $.get(options, (err, resp, data) => {
472 try {
473 if (err) {
474 $.log('API请求失败')
475 $.logErr(JSON.stringify(err));
476 } else {
477 $.log(`赛跑助力结果${data}`);
478 data = JSON.parse(data);
479 // {"errorCode":"help_ok","errorMessage":null,"currentTime":1600479266133,"data":{"rewardNum":5,"helpStatus":"help_ok","newUser":false},"success":true}
480 if (data.errorCode === 'help_ok' && data.data.helpStatus === 'help_ok') {
481 console.log(`助力${friendPin}成功\n获得狗粮${data.data.rewardNum}g\n`);
482 $.runReward += data.data.rewardNum;
483 }
484 }
485 } catch (e) {
486 $.logErr(e, resp)
487 } finally {
488 resolve(data);
489 }
490 });
491 })
492}
493function combatDetail(invitePin) {
494 return new Promise(resolve => {
495 headers.Cookie = cookie;

Callers 1

runFunction · 0.85

Calls 4

taroRequestFunction · 0.70
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected