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

Function getTaskList

activity/jx_sign.js:110–142  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

108 })
109}
110function getTaskList() {
111 return new Promise((resolve) => {
112 $.get(taskUrl("pgcenter/task/QueryPgTaskCfgByType","taskType=3"), async (err, resp, data) => {
113 try {
114 if (err) {
115 console.log(`${JSON.stringify(err)}`)
116 console.log(`${$.name} API请求失败,请检查网路重试`)
117 } else {
118 if (safeGet(data)) {
119 data = JSON.parse(data);
120 if(data.retCode ===0){
121 for (task of data.data.tasks) {
122 if(task.taskState===1){
123 console.log(`去做${task.taskName}任务`)
124 await doTask(task.taskId);
125 await $.wait(1000)
126 await finishTask(task.taskId);
127 await $.wait(1000)
128 }
129 }
130 }else{
131 console.log(`签到失败,错误信息${data.errMsg}`)
132 }
133 }
134 }
135 } catch (e) {
136 $.logErr(e, resp)
137 } finally {
138 resolve(data);
139 }
140 })
141 })
142}
143function doTask(id) {
144 return new Promise((resolve) => {
145 $.get(taskUrl("pgcenter/task/drawUserTask",`taskid=${id}`), async (err, resp, data) => {

Callers 1

jdCashFunction · 0.70

Calls 8

finishTaskFunction · 0.85
taskUrlFunction · 0.70
safeGetFunction · 0.70
doTaskFunction · 0.70
getMethod · 0.45
logMethod · 0.45
waitMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected