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

Function doTask

activity/jd_firecrackers.js:168–196  ·  view source on GitHub ↗
(taskId)

Source from the content-addressed store, hash-verified

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

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