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

Function doTask

jd_speed_sign.js:218–245  ·  view source on GitHub ↗
(taskId)

Source from the content-addressed store, hash-verified

216}
217
218async function doTask(taskId) {
219 return new Promise(resolve => {
220 $.get(taskUrl('ClientHandleService.execute', {
221 "method": "marketTaskRewardPayment",
222 "data": {"channel": 1, "clientTime": +new Date() + 0.588, "activeType": taskId}
223 }), async (err, resp, data) => {
224 try {
225 if (err) {
226 console.log(`${JSON.stringify(err)}`)
227 console.log(`${$.name} API请求失败,请检查网路重试`)
228 } else {
229 if (safeGet(data)) {
230 data = JSON.parse(data);
231 if (data.code === 0) {
232 console.log(`${data.data.taskInfo.mainTitle}任务完成成功,预计获得${data.data.reward}金币`)
233 } else {
234 console.log(`任务完成失败,${data.message}`)
235 }
236 }
237 }
238 } catch (e) {
239 $.logErr(e, resp)
240 } finally {
241 resolve(data);
242 }
243 })
244 })
245}
246
247async function queryJoy() {
248 return new Promise(resolve => {

Callers 1

taskListFunction · 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