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

Function share

hellobike/hellobike.js:129–159  ·  view source on GitHub ↗
(token)

Source from the content-addressed store, hash-verified

127}
128
129function share(token) {
130 if (!token) {
131 return Promise.resolve({})
132 }
133 return new Promise((resolve, reject) => {
134 let action = 'happy.energy.dailyShare'
135 let options = {
136 url: API_URL,
137 headers: { 'User-Agent': UA },
138 body: JSON.stringify({
139 token,
140 action,
141 ticket: '',
142 }),
143 }
144 HELLO_BIKE.post(options, (error, response, data) => {
145 if (error) {
146 HELLO_BIKE.log(TASK_NAME, `分享失败,error:${error}`)
147 reject(new RequestFailed(action, error))
148 return
149 }
150 let result = JSON.parse(data)
151 if (result && result.code === 0) {
152 resolve(result)
153 } else {
154 HELLO_BIKE.log(TASK_NAME, `分享失败,response:${data}`)
155 reject(new RequestFailed(action, result.msg, result.code === 103))
156 }
157 })
158 })
159}
160
161function getEnergyList(token) {
162 if (!token) {

Callers 1

hellobike.jsFile · 0.70

Calls 2

postMethod · 0.45
logMethod · 0.45

Tested by

no test coverage detected