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

Function doTask

activity/jd_firecrackers2.js:162–190  ·  view source on GitHub ↗
(taskId)

Source from the content-addressed store, hash-verified

160}
161
162function doTask(taskId) {
163 let body = `taskid=${taskId}`
164 return new Promise(resolve => {
165 $.get(taskUrl('family_task', body), async (err, resp, data) => {
166 try {
167 if (err) {
168 console.log(`${err},${jsonParse(resp.body)['message']}`)
169 console.log(`${$.name} API请求失败,请检查网路重试`)
170 } else {
171 let res = data.match(/query\((.*)\n/)[1];
172 data = JSON.parse(res);
173 if (data.ret === 0) {
174 console.log(`任务完成成功`)
175 } else if (data.ret === 1001) {
176 console.log(`任务完成失败,原因:这个账号黑号了!!!`)
177 resolve(false);
178 return;
179 } else {
180 console.log(`任务完成失败,原因未知`)
181 }
182 }
183 } catch (e) {
184 $.logErr(e, resp)
185 } finally {
186 resolve(data);
187 }
188 })
189 })
190}
191
192function draw() {
193 let body = `level=1&type=2`

Callers 1

getUserInfoFunction · 0.70

Calls 5

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

Tested by

no test coverage detected