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

Function request

jd_pet.js:610–629  ·  view source on GitHub ↗
(function_id, body = {})

Source from the content-addressed store, hash-verified

608}
609// 请求
610async function request(function_id, body = {}) {
611 await $.wait(3000); //歇口气儿, 不然会报操作频繁
612 return new Promise((resolve, reject) => {
613 $.post(taskUrl(function_id, body), (err, resp, data) => {
614 try {
615 if (err) {
616 console.log('\n东东萌宠: API查询请求失败 ‼️‼️');
617 console.log(JSON.stringify(err));
618 $.logErr(err);
619 } else {
620 data = JSON.parse(data);
621 }
622 } catch (e) {
623 $.logErr(e, resp);
624 } finally {
625 resolve(data)
626 }
627 })
628 })
629}
630// function taskUrl(function_id, body = {}) {
631// return {
632// url: `${JD_API_HOST}?functionId=${function_id}&appid=wh5&loginWQBiz=pet-town&body=${escape(JSON.stringify(body))}`,

Callers 15

index.jsFile · 0.70
checkFunction · 0.70
jdPetFunction · 0.70
energyCollectFunction · 0.70
feedPetsAgainFunction · 0.70
masterHelpInitFunction · 0.70
slaveHelpFunction · 0.70
petSportFunction · 0.70
taskInitFunction · 0.70
signInitFunFunction · 0.70
threeMealInitFunFunction · 0.70
browseSingleShopInitFunction · 0.70

Calls 5

taskUrlFunction · 0.70
waitMethod · 0.45
postMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected