| 210 | } |
| 211 | |
| 212 | function receiveRedRain(actId) { |
| 213 | return new Promise(resolve => { |
| 214 | const body = { actId }; |
| 215 | $.get(taskUrl('noahRedRainLottery', body), (err, resp, data) => { |
| 216 | try { |
| 217 | if (err) { |
| 218 | console.log(`${JSON.stringify(err)}`) |
| 219 | console.log(`${$.name} API请求失败,请检查网路重试`) |
| 220 | } else { |
| 221 | if (safeGet(data)) { |
| 222 | data = JSON.parse(data); |
| 223 | if (data.subCode === '0') { |
| 224 | console.log(`领取成功,获得${JSON.stringify(data.lotteryResult)}`) |
| 225 | // message+= `领取成功,获得${JSON.stringify(data.lotteryResult)}\n` |
| 226 | message += `领取成功,获得 ${(data.lotteryResult.jPeasList[0].quantity)}京豆` |
| 227 | allMessage += `京东账号${$.index}${$.nickName || $.UserName}\n领取成功,获得 ${(data.lotteryResult.jPeasList[0].quantity)}京豆${$.index !== cookiesArr.length ? '\n\n' : ''}`; |
| 228 | } else if (data.subCode === '8') { |
| 229 | console.log(`领取失败:本场已领过`) |
| 230 | message += `领取失败,本场已领过`; |
| 231 | } else { |
| 232 | console.log(`异常:${JSON.stringify(data)}`) |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | } catch (e) { |
| 237 | $.logErr(e, resp) |
| 238 | } finally { |
| 239 | resolve(); |
| 240 | } |
| 241 | }) |
| 242 | }) |
| 243 | } |
| 244 | |
| 245 | function taskGetUrl(url, body) { |
| 246 | return { |