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

Function getTaskInfo

activity/jd_nh.js:346–372  ·  view source on GitHub ↗
(taskType, value)

Source from the content-addressed store, hash-verified

344}
345// 做任务
346function getTaskInfo(taskType, value) {
347 let body = `activityId=${ACT_ID}&pin=${encodeURIComponent($.pin)}&actorUuid=${$.actorUuid}&taskType=${taskType}&taskValue=${value}`
348 return new Promise(resolve => {
349 $.post(taskPostUrl('dingzhi/vm/template/taskInfo', body), async (err, resp, data) => {
350 try {
351 if (err) {
352 console.log(`${err}`)
353 console.log(`${$.name} API请求失败,请检查网路重试`)
354 } else {
355 if (safeGet(data)) {
356 data = JSON.parse(data);
357 if (data.result && data.data) {
358 resolve(data.data.data.data)
359 } else {
360 console.log(`任务完成失败,错误信息:${data.errorMessage}`)
361 }
362 }
363 }
364 } catch (e) {
365 $.logErr(e, resp)
366 } finally {
367 resolve(data);
368 }
369 })
370 })
371
372}
373// 完成任务
374function doTask(taskType, value) {
375 let body = `activityId=${ACT_ID}&pin=${encodeURIComponent($.pin)}&actorUuid=${$.actorUuid}&taskType=${taskType}&taskValue=${value}`

Callers 1

getActContentFunction · 0.70

Calls 5

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

Tested by

no test coverage detected