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

Function getRedRain

activity/jd_ms_redrain.js:91–122  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

89 })
90}
91function 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}
123function 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}`,

Callers 1

jd_ms_redrain.jsFile · 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