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

Function doTask

activity/jd_xg.js:142–164  ·  view source on GitHub ↗
(taskId)

Source from the content-addressed store, hash-verified

140}
141
142function doTask(taskId) {
143 let body = `task_bless=10&taskid=${taskId}`
144 return new Promise(resolve => {
145 $.get(taskUrl('completeTask', body), async (err, resp, data) => {
146 try {
147 if (err) {
148 console.log(`${err}`)
149 console.log(`${$.name} API请求失败,请检查网路重试`)
150 } else {
151 data = JSON.parse(data.match(/query\((.*)\n/)[1])
152 if (data.data.complete_task_list.includes(taskId)) {
153 console.log(`任务完成成功,当前幸运值${data.data.curbless}`)
154 $.userInfo.bless = data.data.curbless
155 }
156 }
157 } catch (e) {
158 $.logErr(e, resp)
159 } finally {
160 resolve(data);
161 }
162 })
163 })
164}
165
166function draw() {
167 return new Promise(resolve => {

Callers 1

getUserInfoFunction · 0.70

Calls 4

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

Tested by

no test coverage detected