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

Function rewardTask

jd_speed_sign.js:274–302  ·  view source on GitHub ↗
(id, taskId)

Source from the content-addressed store, hash-verified

272}
273
274async function rewardTask(id, taskId) {
275 return new Promise(resolve => {
276 $.get(taskUrl('ClientHandleService.execute', {
277 "method": "joyTaskReward",
278 "data": {"id": id, "channel": 1, "clientTime": +new Date() + 0.588, "activeType": taskId}
279 }), async (err, resp, data) => {
280 try {
281 if (err) {
282 console.log(`${JSON.stringify(err)}`)
283 console.log(`${$.name} API请求失败,请检查网路重试`)
284 } else {
285 if (safeGet(data)) {
286 data = JSON.parse(data);
287 if (data.code === 0) {
288 $.score += data.data.reward
289 console.log(`气泡收取成功,获得${data.data.reward}金币`)
290 } else {
291 console.log(`气泡收取失败,${data.message}`)
292 }
293 }
294 }
295 } catch (e) {
296 $.logErr(e, resp)
297 } finally {
298 resolve(data);
299 }
300 })
301 })
302}
303
304
305async function queryItem(activeType = 1) {

Callers 1

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