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

Function taskList

jd_speed_sign.js:172–216  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

170}
171
172async function taskList() {
173 return new Promise(resolve => {
174 $.get(taskUrl('ClientHandleService.execute', {
175 "version": "3.1.0",
176 "method": "newTaskCenterPage",
177 "data": {"channel": 1}
178 }),
179 async (err, resp, data) => {
180 try {
181 if (err) {
182 console.log(`${JSON.stringify(err)}`)
183 console.log(`${$.name} API请求失败,请检查网路重试`)
184 } else {
185 if (safeGet(data)) {
186 data = JSON.parse(data);
187 for (let task of data.data) {
188 $.taskName = task.taskInfo.mainTitle
189 if (task.taskInfo.status === 0) {
190 if (task.taskType >= 1000) {
191 await doTask(task.taskType)
192 await $.wait(1000)
193 } else {
194 $.canStartNewItem = true
195 while ($.canStartNewItem) {
196 if (task.taskType !== 3) {
197 await queryItem(task.taskType)
198 } else {
199 await startItem("", task.taskType)
200 }
201 }
202 }
203 } else {
204 console.log(`${task.taskInfo.mainTitle}已完成`)
205 }
206 }
207 }
208 }
209 } catch (e) {
210 $.logErr(e, resp)
211 } finally {
212 resolve(data);
213 }
214 })
215 })
216}
217
218async function doTask(taskId) {
219 return new Promise(resolve => {

Callers 1

jdGlobalFunction · 0.70

Calls 9

queryItemFunction · 0.85
startItemFunction · 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