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

Function TotalBean

jd_ms.js:259–302  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

257}
258
259function TotalBean() {
260 return new Promise(async resolve => {
261 const options = {
262 "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
263 "headers": {
264 "Accept": "application/json,text/plain, */*",
265 "Content-Type": "application/x-www-form-urlencoded",
266 "Accept-Encoding": "gzip, deflate, br",
267 "Accept-Language": "zh-cn",
268 "Connection": "keep-alive",
269 "Cookie": cookie,
270 "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
271 "User-Agent": $.isNode() ? (process.env.JD_USER_AGENT ? process.env.JD_USER_AGENT : (require('./USER_AGENTS').USER_AGENT)) : ($.getdata('JDUA') ? $.getdata('JDUA') : "jdapp;iPhone;9.4.4;14.3;network/4g;Mozilla/5.0 (iPhone; CPU iPhone OS 14_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148;supportJDSHWK/1")
272 }
273 }
274 $.post(options, (err, resp, data) => {
275 try {
276 if (err) {
277 console.log(`${JSON.stringify(err)}`)
278 console.log(`${$.name} API请求失败,请检查网路重试`)
279 } else {
280 if (data) {
281 data = JSON.parse(data);
282 if (data['retcode'] === 13) {
283 $.isLogin = false; //cookie过期
284 return
285 }
286 if (data['retcode'] === 0) {
287 $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
288 } else {
289 $.nickName = $.UserName
290 }
291 } else {
292 console.log(`京东服务器返回空数据`)
293 }
294 }
295 } catch (e) {
296 $.logErr(e, resp)
297 } finally {
298 resolve();
299 }
300 })
301 })
302}
303
304function safeGet(data) {
305 try {

Callers 1

jd_ms.jsFile · 0.70

Calls 5

isNodeMethod · 0.45
getdataMethod · 0.45
postMethod · 0.45
logMethod · 0.45
logErrMethod · 0.45

Tested by

no test coverage detected