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

Function doTask

jd_xtg_help.js:271–290  ·  view source on GitHub ↗
(type, id, functionID = 'doBrowse')

Source from the content-addressed store, hash-verified

269 });
270}
271function doTask(type, id, functionID = 'doBrowse') {
272 return new Promise(async (resolve) => {
273 const options = taskPostUrl(`task/${functionID}`, functionID, `starId=${$.activeId}&id=${id}&type=${type}`)
274 $.post(options, (err, resp, data) => {
275 try {
276 if (err) {
277 console.log(`${JSON.stringify(err)}`);
278 console.log(`${$.name} API请求失败,请检查网路重试`);
279 } else {
280 console.log(`doBrowse做任务结果:${data}`);
281 data = JSON.parse(data);
282 }
283 } catch (e) {
284 $.logErr(e, resp);
285 } finally {
286 resolve(data);
287 }
288 });
289 });
290}
291function getBrowsePrize(browseId) {
292 return new Promise(async (resolve) => {
293 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