| 272 | } |
| 273 | |
| 274 | async 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 | |
| 305 | async function queryItem(activeType = 1) { |