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

Function doTask

jd_xtg.js:323–342  ·  view source on GitHub ↗
(type, id, functionID = 'doBrowse')

Source from the content-addressed store, hash-verified

321 });
322}
323function doTask(type, id, functionID = 'doBrowse') {
324 return new Promise(async (resolve) => {
325 const options = taskPostUrl(`task/${functionID}`, functionID, `starId=${$.activeId}&id=${id}&type=${type}`)
326 $.post(options, (err, resp, data) => {
327 try {
328 if (err) {
329 console.log(`${JSON.stringify(err)}`);
330 console.log(`${$.name} API请求失败,请检查网路重试`);
331 } else {
332 console.log(`doBrowse做任务结果:${data}`);
333 data = JSON.parse(data);
334 }
335 } catch (e) {
336 $.logErr(e, resp);
337 } finally {
338 resolve(data);
339 }
340 });
341 });
342}
343function getBrowsePrize(browseId) {
344 return new Promise(async (resolve) => {
345 const options = taskPostUrl('task/getBrowsePrize', 'getBrowsePrize', `starId=${$.activeId}&browseId=${browseId}`)

Callers 1

JD_XTGFunction · 0.70

Calls 4

taskPostUrlFunction · 0.70
postMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected