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

Function doTask

activity/jd_festival.js:290–314  ·  view source on GitHub ↗
(type)

Source from the content-addressed store, hash-verified

288}
289
290function doTask(type) {
291 return new Promise(resolve => {
292 $.get(taskUrl('task/doTask', {type: type}), async (err, resp, data) => {
293 try {
294 if (err) {
295 console.log(`${JSON.stringify(err)}`)
296 console.log(`${$.name} API请求失败,请检查网路重试`)
297 } else {
298 if (safeGet(data)) {
299 data = JSON.parse(data);
300 if (data.code === 200) {
301 console.log(`任务完成成功`)
302 } else {
303 console.log(`任务完成失败`)
304 }
305 }
306 }
307 } catch (e) {
308 $.logErr(e, resp)
309 } finally {
310 resolve();
311 }
312 })
313 })
314}
315
316function doReceive(type) {
317 return new Promise(resolve => {

Callers 1

getTaskFunction · 0.70

Calls 5

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

Tested by

no test coverage detected