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

Function TotalBean

activity/jd_split.js:245–288  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

243 }
244}
245function TotalBean() {
246 return new Promise(async resolve => {
247 const options = {
248 "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
249 "headers": {
250 "Accept": "application/json,text/plain, */*",
251 "Content-Type": "application/x-www-form-urlencoded",
252 "Accept-Encoding": "gzip, deflate, br",
253 "Accept-Language": "zh-cn",
254 "Connection": "keep-alive",
255 "Cookie": cookie,
256 "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
257 "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")
258 }
259 }
260 $.post(options, (err, resp, data) => {
261 try {
262 if (err) {
263 console.log(`${JSON.stringify(err)}`)
264 console.log(`${$.name} API请求失败,请检查网路重试`)
265 } else {
266 if (data) {
267 data = JSON.parse(data);
268 if (data['retcode'] === 13) {
269 $.isLogin = false; //cookie过期
270 return
271 }
272 if (data['retcode'] === 0) {
273 $.nickName = (data['base'] && data['base'].nickname) || $.UserName;
274 } else {
275 $.nickName = $.UserName
276 }
277 } else {
278 console.log(`京东服务器返回空数据`)
279 }
280 }
281 } catch (e) {
282 $.logErr(e, resp)
283 } finally {
284 resolve();
285 }
286 })
287 })
288}
289function safeGet(data) {
290 try {
291 if (typeof JSON.parse(data) == "object") {

Callers 1

jd_split.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