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

Function getRedRain

activity/jd_live_redrain2.js:93–119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91}
92
93function getRedRain() {
94 return new Promise(resolve => {
95 $.post(taskPostUrl('liveActivityV842'), (err, resp, data) => {
96 try {
97 if (err) {
98 console.log(`${JSON.stringify(err)}`)
99 console.log(`${$.name} API请求失败,请检查网路重试`)
100 } else {
101 if (safeGet(data)) {
102 data = JSON.parse(data);
103 let act = data.data.iconArea[0]
104 let url = data.data.iconArea[0].data.activityUrl
105 $.activityId = url.substr(url.indexOf("id=") + 3)
106 $.startTime = act.startTime
107 $.endTime = act.endTime
108 console.log(`下一场红包雨开始时间:${new Date(act.startTime)}`)
109 console.log(`下一场红包雨结束时间:${new Date(act.endTime)}`)
110 }
111 }
112 } catch (e) {
113 $.logErr(e, resp)
114 } finally {
115 resolve();
116 }
117 })
118 })
119}
120
121function receiveRedRain() {
122 return new Promise(resolve => {

Callers 1

Calls 5

taskPostUrlFunction · 0.70
safeGetFunction · 0.70
postMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected