| 89 | }) |
| 90 | } |
| 91 | function getRedRain() { |
| 92 | return new Promise(resolve => { |
| 93 | const body = {"actId":"RRA318jCtaXhZJgiLryM1iydEhc7Jna"}; |
| 94 | $.get(taskUrl('noahRedRainLottery', body), (err, resp, data) => { |
| 95 | try { |
| 96 | if (err) { |
| 97 | console.log(`${JSON.stringify(err)}`) |
| 98 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 99 | } else { |
| 100 | if (safeGet(data)) { |
| 101 | data = JSON.parse(data); |
| 102 | if (data.subCode === '0') { |
| 103 | console.log(`领取成功,获得${JSON.stringify(data.lotteryResult)}`) |
| 104 | // message+= `领取成功,获得${JSON.stringify(data.lotteryResult)}\n` |
| 105 | message+= `${data.lotteryResult.jPeasList[0].ext}:${(data.lotteryResult.jPeasList[0].quantity)}京豆\n` |
| 106 | |
| 107 | } else if (data.subCode === '8') { |
| 108 | console.log(`今日次数已满`) |
| 109 | message += `领取失败,今日已签到\n`; |
| 110 | } else { |
| 111 | console.log(`异常:${JSON.stringify(data)}`) |
| 112 | } |
| 113 | } |
| 114 | } |
| 115 | } catch (e) { |
| 116 | $.logErr(e, resp) |
| 117 | } finally { |
| 118 | resolve(); |
| 119 | } |
| 120 | }) |
| 121 | }) |
| 122 | } |
| 123 | function taskUrl(function_id, body = {}) { |
| 124 | return { |
| 125 | url: `${JD_API_HOST}?functionId=${function_id}&body=${escape(JSON.stringify(body))}&client=wh5&clientVersion=1.0.0&_=${new Date().getTime() + new Date().getTimezoneOffset()*60*1000 + 8*60*60*1000}`, |