MCPcopy Create free account
hub / github.com/chavyleung/scripts / checkin

Function checkin

hellobike/hellobike.js:97–127  ·  view source on GitHub ↗
(token)

Source from the content-addressed store, hash-verified

95}
96
97function checkin(token) {
98 if (!token) {
99 return Promise.resolve({})
100 }
101 return new Promise((resolve, reject) => {
102 let action = 'happy.energy.dailyCheck.v2'
103 let options = {
104 url: API_URL,
105 headers: { 'User-Agent': UA },
106 body: JSON.stringify({
107 action,
108 token,
109 ticket: '',
110 }),
111 }
112 HELLO_BIKE.post(options, (error, response, data) => {
113 if (error) {
114 HELLO_BIKE.log(TASK_NAME, `签到失败,error:${error}`)
115 reject(new RequestFailed(action, error))
116 return
117 }
118 let result = JSON.parse(data)
119 if (result && result.code === 0 && result.data) {
120 resolve(result.data)
121 } else {
122 HELLO_BIKE.log(TASK_NAME, `签到失败,response:${data}`)
123 reject(new RequestFailed(action, result.msg, result.code === 103))
124 }
125 })
126 })
127}
128
129function share(token) {
130 if (!token) {

Callers 1

hellobike.jsFile · 0.70

Calls 2

postMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected