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

Function getToken

jd_bookshop.js:215–235  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

213
214// 获得游戏的Token
215function getToken() {
216 return new Promise(resolve => {
217 let body = `userId=${$.shopId}&token=${$.token2}&fromType=APP`
218 $.post(taskPostUrl('customer/getMyPing', body), async (err, resp, data) => {
219 try {
220 if (err) {
221 console.log(`${$.name} API请求失败,请检查网路重试`)
222 } else {
223 if (safeGet(data)) {
224 data = JSON.parse(data);
225 $.token = data.data.secretPin
226 }
227 }
228 } catch (e) {
229 $.logErr(e, resp)
230 } finally {
231 resolve(data);
232 }
233 })
234 })
235}
236
237// 获得用户信息
238function getUserInfo() {

Callers 1

jdBeautyFunction · 0.70

Calls 5

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

Tested by

no test coverage detected