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

Function getTaskList

activity/jd_immortal.js:284–336  ·  view source on GitHub ↗
(body = {})

Source from the content-addressed store, hash-verified

282}
283
284function getTaskList(body = {}) {
285
286 return new Promise(resolve => {
287 $.post(taskPostUrl("mcxhd_brandcity_taskList", body, "mcxhd_brandcity_taskList"), async (err, resp, data) => {
288 try {
289 if (err) {
290 console.log(`${JSON.stringify(err)}`)
291 console.log(`${$.name} API请求失败,请检查网路重试`)
292 } else {
293 if (safeGet(data)) {
294 data = JSON.parse(data);
295 $.tasks = []
296 if (data.retCode === '200') {
297 $.tasks = data.result.tasks
298 for (let vo of $.tasks) {
299 if (vo.taskType === "13" || vo.taskType === "2" || vo.taskType === "5" || vo.taskType === "3") {
300 // 签到,逛一逛
301 for (let i = vo.times, j = 0; i < vo.maxTimes && j < vo.subItem.length; ++i, ++j) {
302 console.log(`去做${vo.taskName}任务,${i + 1}/${vo.maxTimes}`)
303 let item = vo['subItem'][j]
304 await doTask(item['itemToken'])
305 await $.wait((vo.waitDuration ? vo.waitDuration : 5 + 1) * 1000)
306 }
307 } else if (vo.taskType === "7" || vo.taskType === "9") {
308 // 浏览店铺,会场
309 for (let i = vo.times, j = 0; i < vo.maxTimes; ++i, ++j) {
310 console.log(`去做${vo.taskName}任务,${i + 1}/${vo.maxTimes}`)
311 let item = vo['subItem'][j]
312 $.duration = vo.waitDuration + 1
313 await doTask(item['itemToken'])
314 await $.wait((vo.waitDuration + 1) * 1000)
315 await doTask2(item['taskToken'])
316 }
317 } else if (vo.taskType === "6") {
318 // 邀请好友
319 if (vo.subItem.length) {
320 console.log(`您的好友助力码为${vo.subItem[0].itemToken}`)
321 } else {
322 console.log(`无法查询您的好友助力码`)
323 }
324 }
325 }
326 }
327 }
328 }
329 } catch (e) {
330 $.logErr(e, resp)
331 } finally {
332 resolve();
333 }
334 })
335 })
336}
337
338function readShareCode() {
339 console.log(`开始`)

Callers 1

jdNianFunction · 0.70

Calls 8

taskPostUrlFunction · 0.70
safeGetFunction · 0.70
doTaskFunction · 0.70
doTask2Function · 0.70
postMethod · 0.45
logMethod · 0.45
waitMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected