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

Function recordTask

jd_crazy_joy.js:318–344  ·  view source on GitHub ↗
(taskId, taskRecordId)

Source from the content-addressed store, hash-verified

316}
317
318function recordTask(taskId, taskRecordId) {
319 let body = {"action": "INCREASE", "taskId": taskId, "taskRecordId": taskRecordId}
320 return new Promise(async resolve => {
321 $.get(taskUrl('crazyJoy_task_viewPage', JSON.stringify(body)), async (err, resp, data) => {
322 try {
323 if (err) {
324 console.log(`${JSON.stringify(err)}`)
325 console.log(`${$.name} API请求失败,请检查网路重试`)
326 } else {
327 if (safeGet(data)) {
328 data = JSON.parse(data);
329 if (data.success) {
330 console.log(`任务【${data.data.taskTitle}】记录成功,去领奖`)
331 await awardTask(taskId)
332 } else {
333 console.log(`获取信息失败`)
334 }
335 }
336 }
337 } catch (e) {
338 $.logErr(e, resp)
339 } finally {
340 resolve();
341 }
342 })
343 })
344}
345
346function awardTask(taskId) {
347 let body = {"taskId": taskId}

Callers 1

doTaskFunction · 0.85

Calls 6

taskUrlFunction · 0.70
safeGetFunction · 0.70
awardTaskFunction · 0.70
getMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected