MCPcopy Create free account
hub / github.com/6dylan6/jdpro / GetnickName2

Function GetnickName2

function/sendNotify.js:2032–2073  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2030}
2031
2032function GetnickName2() {
2033 return new Promise(async(resolve) => {
2034 const options = {
2035 "url": `https://wq.jd.com/user/info/QueryJDUserInfo?sceneval=2`,
2036 "headers": {
2037 "Accept": "application/json,text/plain, */*",
2038 "Content-Type": "application/x-www-form-urlencoded",
2039 "Accept-Encoding": "gzip, deflate, br",
2040 "Accept-Language": "zh-cn",
2041 "Connection": "keep-alive",
2042 "Cookie": cookie,
2043 "Referer": "https://wqs.jd.com/my/jingdou/my.shtml?sceneval=2",
2044 "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")
2045 }
2046 };
2047 $.post(options, (err, resp, data) => {
2048 try {
2049 if (err) {
2050 $.logErr(err);
2051 } else {
2052 if (data) {
2053 data = JSON.parse(data);
2054 if (data['retcode'] === 13) {
2055 $.isLogin = false; //cookie过期
2056 return
2057 }
2058 if (data['retcode'] === 0) {
2059 $.nickName = (data['base'] && data['base'].nickname) || "";
2060 }
2061 } else {
2062 $.log('京东服务器返回空数据');
2063 }
2064 }
2065 } catch (e) {
2066 $.logErr(e);
2067 }
2068 finally {
2069 resolve();
2070 }
2071 });
2072 });
2073}
2074const got = require('got');
2075require('dotenv').config();
2076let exists = fs.existsSync('/ql/data/config/auth.json');

Callers 2

sendNotifyFunction · 0.70
sendNotifybyWxPucherFunction · 0.70

Calls 5

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

Tested by

no test coverage detected