| 456 | } |
| 457 | //领取200京豆 |
| 458 | function pg_interact_interface_invoke(floorToken) { |
| 459 | const body = {floorToken, "dataSourceCode": "takeReward", "argMap": {}} |
| 460 | const options = { |
| 461 | url: `${JD_API_HOST}?functionId=pg_interact_interface_invoke&body=${escape(JSON.stringify(body))}&appid=swat_miniprogram&fromType=wxapp×tamp=${new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000}`, |
| 462 | headers: { |
| 463 | "Accept": "*/*", |
| 464 | "Accept-Encoding": "gzip, deflate, br", |
| 465 | "Accept-Language": "zh-cn", |
| 466 | "Connection": "keep-alive", |
| 467 | "Content-Type": "application/x-www-form-urlencoded", |
| 468 | "Host": "api.m.jd.com", |
| 469 | "Referer": "https://servicewechat.com/wxa5bf5ee667d91626/108/page-frame.html", |
| 470 | "Cookie": cookie, |
| 471 | "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1"), |
| 472 | } |
| 473 | } |
| 474 | return new Promise((resolve) => { |
| 475 | $.post(options, (err, resp, data) => { |
| 476 | try { |
| 477 | if (err) { |
| 478 | console.log(`${JSON.stringify(err)}`) |
| 479 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 480 | } else { |
| 481 | if (safeGet(data)) { |
| 482 | data = JSON.parse(data); |
| 483 | if (data['success']) { |
| 484 | console.log(`【做任务 天天领京豆】${data['data']['rewardBeanAmount']}京豆领取成功`); |
| 485 | $.rewardBeanNum += data['data']['rewardBeanAmount']; |
| 486 | message += `${message ? '\n' : ''}【做任务 天天领京豆】${$.rewardBeanNum}京豆`; |
| 487 | } else { |
| 488 | console.log(`【做任务 天天领京豆】${data.message}`); |
| 489 | } |
| 490 | } |
| 491 | } |
| 492 | } catch (e) { |
| 493 | $.logErr(e, resp) |
| 494 | } finally { |
| 495 | resolve(); |
| 496 | } |
| 497 | }) |
| 498 | }) |
| 499 | } |
| 500 | function openRedPacket(floorToken) { |
| 501 | const body = {floorToken, "dataSourceCode": "openRedPacket", "argMap": {}} |
| 502 | const options = { |