Skip to content

Commit 8daf68c

Browse files
committed
更新 jdGuaranteedPrice.js
1 parent 0069e6e commit 8daf68c

2 files changed

Lines changed: 20 additions & 26 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/JDZhiBo.py
2+
/auto_bean_plus.py

task/jdGuaranteedPrice.js

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -483,41 +483,34 @@ function showMsg() {
483483

484484
function totalBean() {
485485
return new Promise((resolve) => {
486-
const options = {
487-
url: `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
486+
const opts = {
487+
url: 'https://wq.jd.com/user_new/info/GetJDUserInfoUnion?orgFlag=JD_PinGou_New&callSource=mainorder&channel=4&isHomewhite=0&sceneval=2&sceneval=2&g_login_type=1g_ty=ls',
488488
headers: {
489-
Accept: 'application/json,text/plain, */*',
490-
'Content-Type': 'application/x-www-form-urlencoded',
491-
'Accept-Encoding': 'gzip, deflate, br',
492-
'Accept-Language': 'zh-cn',
493-
Connection: 'keep-alive',
489+
Accept: `*/*`,
490+
Connection: `keep-alive`,
494491
Cookie: $.cookie,
495-
Referer: 'https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2',
496-
'User-Agent':
497-
'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/604.1',
492+
Host: `wq.jd.com`,
493+
'Accept-Language': 'zh-cn',
494+
'Accept-Encoding': 'gzip, deflate, br',
495+
'User-Agent': `Mozilla/5.0 (iPhone; CPU iPhone OS 14_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.1 Mobile/15E148 Safari/604.1`,
496+
Referer: `https://home.m.jd.com/myJd/home.action`
498497
},
499498
};
500-
$.post(options, (err, resp, data) => {
499+
500+
$.get(opts, (err, resp, data) => {
501+
let userInfo;
502+
501503
try {
502-
if (err) {
503-
console.log(`${JSON.stringify(err)}`);
504-
console.log(`${$.name} API请求失败,请检查网路重试`);
505-
} else {
506-
if (data) {
507-
data = JSON.parse(data);
508-
if (data['retcode'] === 13) {
509-
return;
510-
}
511-
$.isLogin = true;
512-
$.nickName = data['base'].nickname;
513-
} else {
514-
console.log(`京东服务器返回空数据`);
515-
}
504+
const res = JSON.parse(data)
505+
if(res['retcode'] === 0){
506+
$.isLogin = true;
507+
userInfo = res.data.userInfo;
508+
$.nickName = userInfo['baseInfo'].nickname;
516509
}
517510
} catch (e) {
518511
$.logErr(e, resp);
519512
} finally {
520-
resolve();
513+
resolve(userInfo);
521514
}
522515
});
523516
});

0 commit comments

Comments
 (0)